In EJB1.1 specification,Sun ask us to maintain the Primary key field name in Deployment Descriptor instead of writing Primary key class.
Is it applicable for Container Managed Persistence only?
Dont I use it for Bean Managed Persistence?
This actually depends on how u implement the primary key class. If its a wrapper type (Integer, String etc) u need to provide two things. ie <prim-key-class> and <primkey-field>
in ur deployment descriptor for container managed persistence.
If u implement a serialized class for the primary key, u have to mention only the
<prim-key-class>. Here, the class fields has to have a one-one correspondence with that of the bean class fields.
For Bean managed persistence u dont write anything in the deployment descriptor. Everything is managed in the code.
Thanks for your response.
This is what I expected..
When I write Bean Managed persistence bean,Can I use <prim-key-class> and <primkey-field> in the Deployement descriptor instead of writing a primary key class..
This entity bean is bean managed persistence.
Home Interface name : CusHome
Remote Interface name : CusRemote
Bean name : Customer
In deployment descriptor,I mention primary key class like this
<primkey-field> custId </primkey-field>
Is it possible?
Hi Majic Robot,
As per EJB 1.1 specs in CMP you can it is optional to specify list of container-managed fields and specification of the primary key field also
The optional primkey-field may be present in the descriptor if the entity’s persistency-type is Container. So you need not have to specify <primkey-field> custId </primkey-field> in ejb-jar.xml file.
But at least one cmp-field element must be present in the descriptor if the entity’s persistency-type is Container, and none must not be present if the entity’s persistence-type is Bean.