File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Compound Primary Key

 
mini mehta
Ranch Hand
Posts: 120
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the compound primary key class fields need to be subset of the CMP fields defined in the bean class?
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes.
 
mini mehta
Ranch Hand
Posts: 120
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well but if you look at HFE 672 Q46, it doesn't thinks "Primary key fields must be cmp-fields"
 
Suman Sarker
Ranch Hand
Posts: 68
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mini,
Well but if you look at HFE 672 Q46, it doesn't thinks "Primary key fields must be cmp-fields"

Lets see what the spec says about compound primary keys (spec p203 section 10.8.2)
The names of the fields in the primary key class must be a subset of the names of the container-managed fields.

So, now you know that answer to Q46 in HFE is incorrect.
Hope this helps
Suman
 
mini mehta
Ranch Hand
Posts: 120
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Suman. I believed what you said in the answer until I saw this answer in HFE with an explaination. But thanks for confirming the fact.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic