aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Compound Primary Key Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Compound Primary Key" Watch "Compound Primary Key" New topic
Author

Compound Primary Key

mini mehta
Ranch Hand

Joined: Oct 22, 2000
Posts: 120
Does the compound primary key class fields need to be subset of the CMP fields defined in the bean class?
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
Yes.


Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
mini mehta
Ranch Hand

Joined: Oct 22, 2000
Posts: 120
Well but if you look at HFE 672 Q46, it doesn't thinks "Primary key fields must be cmp-fields"
Suman Sarker
Ranch Hand

Joined: May 06, 2004
Posts: 68
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


Suman A Sarker<br />SCJP, SCWCD, SCBCD<br /> <br />If You Can't Beat Them ... Join Them!
mini mehta
Ranch Hand

Joined: Oct 22, 2000
Posts: 120
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Compound Primary Key