Saturday, 28 September 2013

how to define two primary keys Hibernate JPA

how to define two primary keys Hibernate JPA

I have a class in java that has a numerical Id and username (a nature
primary key). I want to define two primary key in hibernate somthng like
that with SQL
Create table X(
Int ID PK,
String name PK,
String adress,
.....
)
And i have already this :
@Entity
@Table(name="Xtable")
public class Xclass{
@Id
@GeneratedValue
@Column(name="ID_X", length=100)
private long ID_X;
@Column(name="Name_X", length=100)
private String Name_X;
}

No comments:

Post a Comment