@idclass vs @embedable
1. @Idclass
2.@embedable
Ref: https://www.objectdb.com/java/jpa/entity/id
@Entity @IdClass(ProjectId.class) public class Project { @Id int departmentId; @Id long projectId; : } Class ProjectId { int departmentId; long projectId; }
2.@embedable
@Entity public class Project { @EmbeddedId ProjectId id; : } @Embeddable Class ProjectId { int departmentId; long projectId; }
Ref: https://www.objectdb.com/java/jpa/entity/id
Comments
Post a Comment