/**
* 任务实体类
*/
@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<Task> children = new HashSet<Task>();
@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<Task> getChildren() {
return children;
}
public void setChildren(Set<Task> children) {
this.children = children;
}
}