220.127.116.11 Primary key that maps to a single field in the entity bean class The Bean Provider uses the primkey-field element of the deployment descriptor to specify the container-managed field of the entity bean class that contains the primary key. The field�s type must be the primary key type.
The container uses the abstract setter and getter method to determine the primary key type. The return type for CMT and BMT ejbCreate()is always the primary key but for CMT, you should always return null (ie in the return statement).The container is able to figure it out. From the spec 14.1.2:
The ejbCreate(...) methods must be defined to return the primary key class type. The implementation of the ejbCreate(...) methods should be coded to return a null. The returned value is ignored by the Container.
Hope it helps
SCJA(Beta) SCJP 1.4 SCWCD 1.4 SCBCD 1.3 SCBCD 5.0 beta <br />The more practice we get, the better we are at the exams and in life in general. Pls join me at My DEN.
we can declare int as a primary key ? And DD would have <primkey-field>int</primkey-field> element in it ?
If so, what would the value of <prim-key-class> be ?
posted 14 years ago
Spec has no direct mention on Primary Key Field Type. But we can infer from other explanation that primkey-class value must always be a Java Class. If your Primary key field is not a compound key and is basically a primitive type then you are supposed to wrap that in Wrapper class. ejbCreate method should always be implemented to return Primary Key Class type. And in that case you should not define prim-key-field in DD. Hope this would clear your doubt.
It's very unfortunate that HFEJB has not discussed about such things in it. [ March 07, 2006: Message edited by: Bhanu P Jasthi ]
Thanks,<br />Bhanu<br />SCEA Step-I<br />SCBCD for J2EE 1.3<br />SCJP1.4
"Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover." - Mark Twain