The ejbCreate method is not defined in a Java interface. However, it is defined by the EJB spec as an expected method in the local or remote interfaces.
SCJP, SCWCD, SCBCD
posted 17 years ago
Actually there is more to it than that. You have a create method in the home interface, and a matching ejbCreate method in the bean class. They have to have a matching set of parameters as well. These are the rules according to the EJB spec.
Howdy For a BMP bean, you use ejbCreate to physically do the insert of a new 'entity' into the database (i.e. probably a new row). The container is expecting the primary key as the return, so that it can then create the EJBObject and stub, and load them with the primary key. For every create in the home, you must also have a matching ejbPostCreate, which for a BMP bean you might not use, but it's there in case you need to complete initializing the entity *after* the EJBObject has been created. The high-level steps are (assuming the client has called create on an entity bean home): 1) ejbCreate is called on the bean -- do the insert and return primary key 2) container makes the EJBObject and stub 3) ejbPostCreate is called and you then have a chance to USE the EJBObject now that it exists (use your EntityContext to get a reference to it) 4) the client gets back the stub to the EJBObject I *think* that's it... we haven't done BMP in a long time, though, so I'm doing this from dusty memories. cheers, Kathy