Saturday, March 10, 2007

How is entity bean created using Container managed entity bean ?

In both container managed and bean managed when the client calls create the call is passed on to ejbCreate.



In a container managed bean ejbCreate method will initialize all instance variables based ont he input arguments passed in. Once ejbCreate method completesthe container will automatically persist the bean. ejbCreate would return null.This is because: it is not practially possible to generate a primary key in ejbCreate and it would be impossible to get hold of the primary key for a row in a table even before the row exists as storage happens only after

ejbCreatecall completes.



In a bean managed persistance the ejbCreate will perform the fallowing:

i. Create an entry in the database

ii. Initialize the instance variables

iii. Return the primary key.



SOURCE : www.referjava.com

No comments: