how to make the two class fields(not referring any other table) as composite key in hibernate?
Posted
by
M Sach
on Stack Overflow
See other posts from Stack Overflow
or by M Sach
Published on 2012-04-10T05:25:05Z
Indexed on
2012/04/10
5:29 UTC
Read the original article
Hit count: 171
i want to make pgId and pgName both as composite key where both pgId anf pgName are assgined values. i am not sure how should i go about it? on net i get examples where composite key column refering to column of some other table but not this kind of scenario?
@Entity
@Table(name = "PersonDetails")
public class PersonDetailsData implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic
private int pgId;
@Basic(optional = true)
@Column(nullable = true)
private int orgId;
@Basic(optional = true)
@Column(nullable = true)
private String pgName;
public PersonWikiDetailsData() {
}
public int getPpId() {
return ppId;
}
public void setPpId(int ppId) {
this.ppId = ppId;
}
public String getSpaceName() {
return spaceName;
}
public void setSpaceName(String spaceName) {
this.spaceName = spaceName;
}
}
© Stack Overflow or respective owner