jQuery in Action, 3rd edition
The moose likes Object Relational Mapping and the fly likes Composite key classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Composite key classes" Watch "Composite key classes" New topic

Composite key classes

Karsten Wutzke
Ranch Hand

Joined: Jul 20, 2010
Posts: 106


do composite key classes have to follow the JavaBean specification, that is, do they have to have getters and setters?


OCJP JavaSE 6 (86%)
James Sutherland
Ranch Hand

Joined: Oct 01, 2007
Posts: 553
By composite key class I assume you mean the JPA IdClass?

The IdClass in JPA must match your Entity Id fields. So if you use field access (annotated the fields) then your IdClass only needs the fields, does not need to methods (although your app may still want the methods). If you use property access (annotate the methods), then your IdClass must have those same methods.

TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance
I agree. Here's the link: http://aspose.com/file-tools
subject: Composite key classes
It's not a secret anymore!