概述
/**
* 任务实体类
*/
@Entity
@Table(name = "t_task")
public class Task implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private Long id;
private String name;
//计划开始时间
private Date plan_startTime;
private Project project;
//父任务
private Task parent;
// 子任务
private Set children = new HashSet();
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Temporal(TemporalType.TIMESTAMP)
public Date getPlan_startTime() {
return plan_startTime;
}
public void setPlan_startTime(Date plan_startTime) {
this.plan_startTime = plan_startTime;
}
@ManyToOne(optional = false, cascade = {CascadeType.REFRESH, CascadeType.MERGE})
@JoinColumn(name = "projectId")
public Project getProject() {
return project;
}
public void setProject(Project project) {
this.project = project;
}
@ManyToOne(cascade = {CascadeType.REFRESH, CascadeType.MERGE})
@JoinColumn(name = "parentId")
public Task getParent() {
return parent;
}
public void setParent(Task parent) {
this.parent = parent;
}
@OrderBy("id ASC")
@OneToMany(mappedBy = "parent", fetch = FetchType.LAZY, cascade = {CascadeType.ALL})
public Set getChildren() {
return children;
}
public void setChildren(Set children) {
this.children = children;
}
}
posted on 2013-11-07 14:40 杨军威 阅读(346) 评论(0) 编辑 收藏
最后
以上就是无心宝马为你收集整理的es映射父子关系java_hibernate实体类映射父子关系的全部内容,希望文章能够帮你解决es映射父子关系java_hibernate实体类映射父子关系所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复