Why does ejbCreate() return null even though the Return Type is the primary key. I remember reading in EDRoman that ejbCreate() actually returned the Primary Key..so what are the conditions under which a null will be returned
OCMJEA/SCEA, SCDJWS, SCBCD 1.3, SCJP 1.4
My SCEA experience:http://javalogue.blogspot.com/
ejbPostCreate() is the method that initializes your bean and contructs EJBObject. Hence, it does n't matter for the ejbCreate() method to return whatever. Once ejbCreate() is done, the container calls the ejbPostCreate() that creates EJBObject having the Primary key as identifier that in turn points to the initialized bean. (i.e the ejbPostCreate() 'ed bean)
The ejbCreate<METHOD>(...)method must return the primary key for the created entity object.
But for a cmp entity bean the specs says
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 isignored by the Container.
In cmp, the container does the figuring out of the pk, using the abstract setter pk method, but for bmp, you have to explicitly handle and return the pk. Remember, it's the container that does the implementation, abstract while you implements a bmp entity bean. Hope ok.
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.
Nothing up my sleeve ... and ... presto! A tiny ad: