hibernate实体assue,onetoone关联多个staffer类,总感觉不对劲,保存一个assue,要 new 3个staffer,是不是直接用Staffer类的主键好点:
/[color=red]/发布者
private Integer publisherId;
//处理人
private Integer completerId;
//审核人
private Integer reviewerId;[/color]
[code="java"]@Entity(name="ASSUE")
public class Assue {
//主键
@Id
@Column(name="ID")
@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="S_Assue")
@SequenceGenerator(name="S_Assue",allocationSize=1,initialValue=1, sequenceName="S_Assue")
private Integer id;
//所属模块
@ManyToOne
private Modular modular;
//发布者
@OneToOne
private Staffer publisher;
//处理人
@OneToOne
private Staffer completer;
//审核人
@OneToOne
private Staffer reviewer;
//发布时间
private Date publishDate;
//有效时间
private Date exprireDate;
//状态 1.有效2无效
private Integer status;
//问题明细
@OneToOne(cascade=CascadeType.ALL)
@JoinColumn(name="assueId",unique=true)
private AssueDetail assueDetail;
//处理流程表
@OneToMany(cascade=CascadeType.ALL)
private Set<AssueWorkflow> assueWorkflows;
...
}[/code]