Well it goes like this i belive. The home interface is a factory for a EJBObject, you need to call create() on the home interface in order for the container to create a new EJBObject or to reuse an instance that was servicing another client. U see when you invoke a method on your bean, the method it's not invoked on the bean itself as u can see the bean class does not implement Remote so it cannot be called directly from the client. The client executes the method on the EJBObject which is either created by the continer when u called create on the session bean home interface, or reuse an existing instance that has been pooled by the container, just so it won;t have to go to the trouble of creating a new instance. EJBObject is your bean with the container magic contained in it: security management,transaction management, bla bla bla so when u call a method on the bean the container could intervine before, after,... the bussiness method is processed. There is no need to call create() on the EJBObject. Lookup Home, call HomeInterface.create() call bussiness method on EJBObject. [ July 17, 2005: Message edited by: Balamaci Serban ]
The client gets an EJBObject stub when it calls create() on the home interface. The stub provides remote EJB access for the client as it is an IIOP proxy to the EJBObject. For a stateless session bean or entity bean, the EJBObject will almost certainly have existed long before the client.
In a clustered configuration, the stub lists all of the servers in the cluster to which the bean should be deployed. As a stateless bean holds no state on behalf of the client, the stub is free to route any call to any server that hosts the bean.
SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Or we might never have existed at all. Freaky. So we should cherish everything. Even this tiny ad: