ssh增删改查(SSH additions and deletions to search).doc
文本预览下载声明
ssh增删改查(SSH additions and deletions to search)
SSH additions and deletions search and change (human resource management system function module)
First, preparation work
Development environment: MyEclipse6.0 +JDK6.0+Tomcat5.0
Struts2+Spring2.0.6+Hibernate3.1. This example provides the basic functions of adding, deleting, modifying, querying and so on through a human resource system. Lib packages need these packages as shown below:
Two. Building database
Three. Establish data persistence layer
Establishing reverse engineering of Hibernate
1, establish entity class and books.hbm.xml mapping file.
Employee.java
Package panyrm.model;
/ * *
* Employee entity.
*
* @author MyEclipse Persistence Tools
* /
Public class Employee implements java.io.Serializable {
Private Long id;
Private String name;
Private String address;
Private String phone;
/ / Constructors
Default constructor / * * * /
Public Employee () {
}
Full constructor / * * * /
Public Employee (String name, String address, String phone) {
T = name;
This.address = address;
This.phone = phone;
}
Property / / accessors
Public Long getId () {
Return this.id;
}
Public void setId (Long ID) {
This.id = id;
}
Public String getName () {
Return ;
}
Public void setName (String name) {
T = name;
}
Public String getAddress () {
Return this.address;
}
Public void setAddress (String address) {
This.address = address;
}
Public String getPhone () {
Return this.phone;
}
Public void setPhone (String phone) {
This.phone = phone;
}
}
2, the entity class Books attribute mapping to the books table, generate the following books.hbm.xml file:
XML version= 1 encoding= UTF-8?
DOCTYPE hibernate-mapping PUBLIC -//Hibernate/Hibernate Mapping DTD 3.0//EN
Http:///hibernate-mapping-3.0.dtd
! --
Mapping file autogenerated by MyEclipse Persistence Tools
--
hibernate-mapping
class name=, panyrm.model.Employee, Employee, schema=, dbo, CompanyRM, catalog=, table=
id name=, Id, type=, java.lang.Long
column name= ID /
generator class= native /
/
显示全部