hibernate一对多单向关联_Annotation
来源:互联网 发布:linux 查看会话 编辑:程序博客网 时间:2024/05/21 22:57
package com.hibernate.rqq;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
@Entity
public class Department {
private intid;
privateString deptName;
privateSet<Employee> emps = new HashSet<Employee>();
@Id
@GeneratedValue
public intgetId() {
returnid;
}
publicString getDeptName() {
returndeptName;
}
@OneToMany
@JoinColumn(name="deptNo")
publicSet<Employee> getEmps() {
returnemps;
}
public voidsetEmps(Set<Employee> emps) {
this.emps= emps;
}
public voidsetId(int id) {
this.id= id;
}
public voidsetDeptName(String deptName) {
this.deptName= deptName;
}
}
package com.hibernate.rqq;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@Entity
public class Employee {
private intid;
privateString empName;
@Id
@GeneratedValue
public intgetId() {
returnid;
}
publicString getEmpName() {
returnempName;
}
public voidsetId(int id) {
this.id= id;
}
public voidsetEmpName(String empName) {
this.empName= empName;
}
}
UML类图写成Set数组了,其实是Set不改了太麻烦
- hibernate一对多单向关联_Annotation
- hibernate多对多单向关联_Annotation
- hibernate多对一单向关联_Annotation
- hibernate一对多/多对一双向关联_Annotation
- Hibernate一对多单向关联
- hibernate一对多单向关联
- hibernate一对多单向关联
- Hibernate单向一对多关联
- hibernate一对多单向关联
- Hibernate 一对多单向关联
- hibernate一对一双向外键关联_Annotation
- hibernate一对一单向主键关联_Annotation
- hibernate 关联关系 一对多 单向关联 .
- hibernate中----一对多单向关联,一对多双向关联
- Hibernate一对多单向关联映射
- Hibernate一对多的单向关联
- Hibernate映射一对多单向关联(之一)
- Hibernate一对多关联映射—单向
- 技术博文搬家了
- 预编译头文件
- sqlite3在winCE下C编译的方法
- IT
- WINCE60下TSPI/TAPI/RIL的区别与联系
- hibernate一对多单向关联_Annotation
- linux下缓冲区溢出实例
- 哪种编程语言更好?真的不重要
- 录文件时不要在mediarecorder设置fps
- hdu 3068 and ural 1297
- sql与oracle中有关case和decode的用法(行转列)及比较
- hdu3999
- QT程序中文显示的其他方法
- JS学习之路--核心对象