This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Composite key classes" Watch "Composite key classes" New topic
Author

Composite key classes

Karsten Wutzke
Ranch Hand

Joined: Jul 20, 2010
Posts: 106

Hello,

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

Karsten


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
 
jQuery in Action, 2nd edition
 
subject: Composite key classes