文档介绍:ssh增删改查(SSH additions and deletions to search)
SSH CRUD (function of human resource management system module)
First, preparation work
Development environment: ++
Struts2++. Through this example of a system of human resources, provide the basic add, delete, modify, query and other functions. Lib packages need these packages as shown below:
Two. Building database
Three. Establish data persistence layer
Establishing reverse engineering of Hibernate
1, the establishment of the entity class and mapping file.
.;
/ * *
* Employee entity.
*
* ***@author MyEclipse Persistence Tools
* /
Public class Employee implements {
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) {
= name;
= address;
= phone;
}
Property / / accessors
Public Long getId () {
Return ;
}
Public void setId (Long ID) {
= id;
}
Public String getName () {
Return ;
}
Public void setName (String name) {
= name;
}
Public String getAddress () {
Return ;
}
Public void setAddress (String address) {
= address;
}
Public String getPhone () {
Return ;
}
Public void setPhone (String phone) {
= phone;
}
}
2, the attribute mapping entity class Books to the books table, to generate the file below:
< XML version= "1" encoding= "UTF-8"? >
DOCTYPE hibernate-mapping "-//Hibernate/Hibernate! PUBLIC Mapping DTD //EN"
"Http://hibernate./hibernate-mapping-" >
<! --
Mapping file autogenerated by MyEclipse Persistence Tools
-- >
<hibernate-mapping>
<class name= "" table= "Employee" schema= "dbo" catalog= "CompanyRM"