A client NEVER DIRECTLY accesses instances of the session bean’s class. A client always uses the session bean’s COMPONENT interface to access a session bean’s instance. The class that implements the session bean’s component interface is provided by the container.
A session EJBObject supports:
The business logic methods of the object. The session EJBObject delegates invocation of a business method to the session bean instance.
Get the session object’s remote home interface.
Get the session object’s handle.
Test if the session object is identical with another session object.
Remove the session object.
public interface EJBObject extends Remote { EJBHome getEJBHome() throws RemoteException; Handle getHandle() throws RemoteException; Object getPrimaryKey() throws RemoteException; boolean isIdentical(EJBObject obj) throws RemoteException; void remove() throws RemoteException, RemoveException; }
A session EJBLocalObject supports:
The business logic methods of the object. The session EJBLocalObject delegates invocation of a business method to the session bean instance.
Get the session object’s local home interface.
Test if the session object is identical with another session object.
Remove the session object.
public interface EJBLocalObject { EJBLocalHome getEJBLocalHome() throws EJBException; Object getPrimaryKey() throws EJBException; boolean isIdentical(EJBLocalObject obj) throws EJBException; void remove() throws RemoveException, EJBException; }
Method getPrimaryKey() on session bean will throw EJBException (local SB) or RemoteException (remote SB) because session bean does not have primary key.
EJBObject interface extends Remote (marker) interface.
Visit http://java.boot.by for the updates.