Enterprise Beans
|
The EJB Home Interface
public interface javax.ejb.EJBHome extends java.rmi.Remote { public abstract EJBMetaData getEJBMetaData(); public abstract void remove (Handle handle); public abstract void remove (Object primaryKey); }
getEJBMetaData()
public interface javax.ejb.EJBMetaData { public abstract EJBHome getEJBHome(); public abstract Class getHomeInterfaceClass(); public abstract Class getPrimaryKeyClass(); public abstract Class getRemoteInterfaceClass(); public abstract boolean isSession(); }
remove(Handle handle)
remove(Object primaryKey)
The EJBHome interface does not provide any methods by which a client can create new beans or look up existing ones. Instead, the EJB bean developer must write the method signatures for these tasks in their own interfaces.
The EJBObject Interface All remote interfaces extend the EJBObject interface:
public interface javax.ejb.EJBObject extends java.rmi.Remote { public abstract EJBHome getEJBHome(); public abstract Handle getHandle(); public abstract Object getPrimaryKey(); public abstract boolean isIdentical (EJBObject obj); public abstract void remove(); }
getEJBHome()
getHandle()
getPrimaryKey()
isIdentical()
Two Entity beans that are from the same home interface and have the same primary key are considered identical.
The two references in this method do not necessarily point to the same object in memory, but all of these instances are considered to have the same identity.
remove()
Note: To create a remote interface, simply create an interface that inherits from EJBObject and add the method signatures of the methods. And there is no need to implement this remote interface. Instead the container generates a proxy object that interacts with remote clients and passes their method calls to the bean.
The EnterpriseBean Interface
public interface javax.ejb.EnterpriseBean extends java.io.Serializable {
}
|
EJB Containers
|
EJB Containers |
a) Support for transactions
b) Support for Management of Multiple Instances
i) Instance Passivation
ii) Instance Pooling
iii) Database Connection Pooling
iv) Precached instances
v) Optimized method invocations
c) Support for persistence
d) Support for security
|
EJB Servers
- It is a “Container Container” – it contains the EJB container
- It is responsible for providing the container with lower-level services such as network connectivity.
- The EJB Specification 1.0 did not outline the exact interface between the EJB container and the EJB server. So, interface is currently left up to the individual vendor.
- At an abstract level, though, the relationship between the container and server is such that the server will provide the container with low-level implementation of the services required by the container.
- The layered architecture is shown below:

