日期:2014-05-17 浏览次数:21009 次
员工实体类
@Entity
@Table(name="tb_user")
public class User {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="id")
private int id;
@Column(name="userName")
private String userName;
@Column(name="password")
private String password;
@ManyToOne(fetch=FetchType.EAGER,cascade={CascadeType.PERSIST})
@JoinColumn(name="department_id")
//Department类型
private Department department_id;
@Column(name="sex")
private String sex;
@Column(name="birthday")
private Date birthday;
@Column(name="phoneNo")
private int phoneNo;
@Column(name="email")
private String email;
@Column(name="address")
private String address;
@Column(name="userDesc")
private String userDesc;
@Column(name="departmentName")
private String departmentName;
public String getDepartmentName() {
return departmentName;
}
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
//Department类型
public Department getDepartment_id() {
return department_id;
}
public void setDepartment_id(Department departmentId) {
department_id = departmentId;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public int getPhoneNo() {
return phoneNo;
}
public void setPhoneNo(int phoneNo) {
this.phoneNo = phoneNo;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getUserDesc() {
return userDesc;
}
public void setUserDesc(String userDesc) {
this.userDesc = userDesc;
}
}
部门实体类
@Entity
@Table(name="tb_department")
public class Department {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="id")
private int id;
@Column(name="departmentName")
private String departmentName;
@Column(n