First page Back Continue Last page Graphics

...Setting Context


Notes:

If the code in your set*Context( ) method fails in some critical way (such as failing to connect to a needed database), signal the failure to the container by throwing EJBException. This will abort creation of the bean instance.
When the client discovers the failure depends on the kind of bean. The container creates stateful session bean instances when the client calls the create( ) method of the home object, so the failure will be detected immediately. But for stateful session beans and entity beans, the container creates instances in advance for a pool. Only when the client calls a business method (in the first case) or create( ) or find*( ) (in the second case) will it learn that there is no bean instance to talk to.