File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Primary keys 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 "Primary keys" Watch "Primary keys" New topic

Primary keys

mprem kumar

Joined: Apr 18, 2005
Posts: 2
Is it so that a primary key of a bean is not modifiable other than during creation and when data was fetched through find methods? So the set accessor method of the class that is specified as a primary key class for that bean[CMP] cannot be called by any means!
Stefan Guilhen
Ranch Hand

Joined: Jul 31, 2004
Posts: 61
Page 130 of the specification says: "Once the primary key for an entity bean has been set, the Bean Provider must not attempt to change it by use of set accessor methods on the primary key cmp-fields. The Bean Provider should therefore not expose the set accessor methods for the primary key cmp-fields in the component interface of the entity bean."

Page 134 completes saying that "If the Bean Provider attempts to reset a primary key value, the container must throw the java.lang.IllegalStateException."


SCJP 1.4, SCBCD 1.3<br />IBM 141, 484, 486
I agree. Here's the link:
subject: Primary keys
It's not a secret anymore!