Author
Compound Primary Key
mini mehta
Ranch Hand
Joined: Oct 22, 2000
Posts: 120
posted Jun 23, 2004 08:08:00
0
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
posted Jun 23, 2004 14:44:00
0
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
posted Jun 24, 2004 09:49:00
0
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: jrebel
subject: Compound Primary Key