如何为子类JPA定义第二个id

时间:2016-12-08 19:48:42

标签: jpa

我有2个课程policepoliceArchive每个人都拥有自己的ID但我无法将2个ID添加到继承实体:

@Entity
@Table
@Inheritance(strategy = InheritanceType.JOINED)
public class Police implements Serializable{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(nullable = false)
private Long idpolice;
@Column(nullable = false)
private String name;
@Column(nullable = false)
private char nature;
..
}

@Entity
@Table
@primarykeyjoincolumn(name="idpolice")
public class PoliceArchive extends Police implements Serializable{
@Column(nullable = false)
private String idArchive;
@Column(nullable = false)
private String applicant;
@Column(nullable = false)
private Date modidficationDate;
..
}

0 个答案:

没有答案