EJB container services

The EJB container is a container that deploys EJB automatically when Web Server is started.

EJB container services

EJB container services

     

The EJB container is a container that deploys EJB automatically when Web Server is started. All of the entity objects live in container during its creation to removal. We can deploy more than one entity beans in a container. When the entity bean is deployed in the container the work of the container is to provide a home interface for the entity bean. This home interface allows a client in removing, creating and finding entity objects. It also helps in executing home interface business methods that are not specific to a particular entity bean object. JNDI(Java Naming and Directory Interface) is the standard interface by which the client can look up the entity bean's home interface.

The table given below illustrates the EJB container services:-

  Services   Description
   Life Cycle Management JRun is an application server that works  for building and deploying server-side Java applications. The role of JRun in the container service is to automatically increase and reduce the number of available bean instances so that there is not much load on the current server.
  Security Security is one of the most important feature of EJB. Since EJB support authentication and role-driven access control. Example below show how this feature is implemented:-

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-application PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Java EE Application 5.0//EN" "http://www.sun.com/software/appserver/dtds/sun-application_5_0-0.dtd">
<sun-application>
<security-role-mapping>
<role-name>USERS</role-name>
<group-name>bank_users</group-name>
</security-role-mapping>

</sun-application>
  Session management    The Server JRun maintains state for stateful session beans and entity beans. The state for session bean is maintained through passivation and activation callback methods. while for the entity beans it is maintained by entity-bean callback methods).
   Transaction By the word transaction we mean a unit of work that must be executed in one piece. EJB provides 2 type of transaction:-
Container-managed transactions:-These type of transaction are the transaction in which the container begins and commits transactions on behalf of the bean. 
Bean-managed transactions:-
In this type of transaction we have complete control over transactions. This control can be achieved either from the client or from the bean itself.