I assume you're asking why it's not in the EJB API in J2EE?
In EJB 2.1 and earlier it does not appear in the actual javax.ejb.* API
because the create() signature is bean specific. That allows the
developer to decide what information should be passed to a Stateful
Session Bean or 2.x Entity Bean at creation time. Stateless session
beans never take any parameters to their create method.
In EJB 3.0, Home interfaces were removed so there aren't any create
mehods needed.Stateful session beans are created as a side
effect or lookup or injection.To pass in specific initialization state
you just define a business method and call it after acquiring the
bean reference.
--ken
As Ken already said, EJB3 does not use Home interfaces and its factory methods, so EJB3 usage is an alernative.
However, if you have to use EJB2.1 or lower, the specs requires to implement exactly one create method for a stateless session bean:
create() in the Home interface and the corresponding ejbCreate() method in the bean implementation.
For stateful session beans, at least one create(PARAM) in the home interface and its corresponding ejbCreate(PARAMS) in the bean class must be defined. In this case create() and ejbCreate() can be overloaded, as long as the create has a corresponding ejbCreate.
For entity beans, create methods or optional, however, each create(PARAMS) definened in the home interface must have a corresponding ejbCreate(PARAMS) and an ejbPostCreate(PARAM) in the bean class
Thank you very much Ken.
The concept is clear.
But i've a queation reg bean specific.
What exactly you mean by bean specific.?.
Where we can find it?.
If i'm not wrong, bean specific means is it Vendor specific.
My req is to just give one example on this bean specific.
Thanks in Advance.
Amar
Hi Amar,
What that means is that in the EJB 2.x (and earlier) programming model for Stateful Session
Beans, the developer decides what the signature of the create() method should be. It all
depends what initializaion information needs to passed in. Naturally, that will be different for
different beans.
E.g., a Shopping Cart SFSB might have :
public ShoppingCart create(String userId);
whereas a simple Counter SFSB might not need any initialization info :
public Counter create();
That's why the create() method was not put in the javax.ejb.SessionBean interface. It
was up to the developer.
--ken