First page Back Continue Last page Graphics

ejbCreate( )


Notes:

The ejbCreate( ) methods are called by the EJB container when a client calls the matching create( ). They all have the syntax shown above.
The bean class must have one of these methods to match each create( ) in the home interface. (And since that interface will have at least one, the bean class will have at least one ejbCreate( ).)
These methods are called by the container when it creates a bean instance. For stateful beans, this happens when the client calls the matching create(). For stateless, when the container populates the pool. They can be used to initialize data. To halt creation, throw a CreateException. And since CreateException is a subclass of Exception, you name it in the throws clause of the method.
ejbCreate( ) Example
This example illustrates the use of ejbCreate( ). It imagines a stateful session bean that talks a legacy application. It does so via a socket connection to the other application's server.

Continued...