If i want severeal Column to make up an ID.
SQL example :
CONSTRAINT [PK_NAME] PRIMARY KEY ([Column1],[Column2],[Column3])
How can
Use @Embeddable and @EmbeddedId.
@Embeddable
@EmbeddedId
Example:
@Entity public class Project { @EmbeddedId ProjectId id; : } @Embeddable Class ProjectId { int departmentId; long projectId; }
More information here http://www.objectdb.com/java/jpa/entity/id#Embedded_Primary_Key_