wood burning stoves 2.0*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes primary key Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "primary key" Watch "primary key" New topic

primary key

sonali rao
Ranch Hand

Joined: Nov 03, 2003
Posts: 64
If a Primary key maps to multiple fields in the Entity bean class then how is the <primkey-field> specified in the deployment descriptor.
Thomas De Vos
stable boy
Ranch Hand

Joined: Apr 12, 2003
Posts: 425
The primkey-field element is not used if the primary key maps to multiple
container-managed fields.
You will use the <prim-key-class> for compound keys.

Try your free <a href="http://www.javacertificate.com" target="_blank" rel="nofollow">SCJP 1.4</a> certification centre.<br />Try your free <a href="http://www.j2eecertificate.com" target="_blank" rel="nofollow">SCWCD</a> certification centre.<br />Try your free <a href="http://www.ejbcertificate.com" target="_blank" rel="nofollow">SCBCD</a> certification centre.<br />Try your <a href="http://www.webspherecertificate.com" target="_blank" rel="nofollow">Websphere (Test 285) </a> certification centre.<br />Try your <a href="http://www.j2mecertificate.com" target="_blank" rel="nofollow">SCMAD</a> certification centre. (New)<br /> <br /><a href="http://blogs.javacertificate.com" target="_blank" rel="nofollow">Java/J2EE Certification Blogging</a>
sonali rao
Ranch Hand

Joined: Nov 03, 2003
Posts: 64
I am still confused.
What if there are 3 fields in the database which are of type String and I want to used 2 of the fields as compound primary key.
How will I mention that in the deployment descriptor using <prim-key-class>
Sudhir V
Ranch Hand

Joined: Dec 25, 2002
Posts: 143
you will make a new class with the two fields as its instance variables and write that class name in the <prim-key-class>

Sudhir V<br />(SCJP 1.2, SCWCD, OCA, SCBCD)
subject: primary key
Similar Threads
ATG Framework
JDBC Callable Statement JConnect2 Returning null resultset
Problem with update data to database
Update the whole info in database instead of one.
Primary key and update method strange issue