Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Composite key classes

 
Karsten Wutzke
Ranch Hand
Posts: 106
Hibernate MySQL Database Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

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

Karsten
 
James Sutherland
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic