EJB Projects

EJB Project 1

EJB Examples


Introduction Of Enterprise Container:
Previous Home Next

Enterprise beans are software components and EJB is a specific architecture to run in a special environment called an EJB container.

The container is hosting and manages an enterprise bean in the same manner that the Java Web Server hosting a servlet or an HTML browser hosts a Java applet. An enterprise bean cannot function outside of an EJB container. The EJB container manages every aspect of an enterprise bean at runtimes including remote access to the bean, security, persistence, transactions, concurrency, and it's access to and pooling of resources.

The container is isolating the enterprise bean from direct access by client applications. When a client application invoking a remote method on an enterprise bean, The Container first intercepts the invocation to ensure persistence, transactions, and security are applied properly to every operation a client performs on the bean.

The container manages security, transactions, and persistence automatically for the bean, so the bean developer doesn't have to write this type of logic into the bean code itself. The enterprise bean developer can focus on encapsulating business rules, while the container takes care of everything else.

An EJB container is nothing but the program that runs on the server and implements the EJB specifications. EJB container providing a special type of the environment, this is suitable for running the enterprise components. Enterprise beans are using in distributed applications that is typically contains the business logic. The container performs the various tasks few of them are illustrated below.

Transaction Management:

EJB container are specially allowing to transaction management that enables the transaction services, and low level implementation for transaction management and co-ordination. The container using the Java Transaction APIs to exposed the transaction services. JTA, a high level interface is used to control transactions.


In EJB container how to contains data and secure data .Then JSE mainly focuses on how to become the environment more secure. Enterprise beans in adding this feature to provide transparent security so that access to the beans can be made secure just by applying the security attributes rather than coding against the security API.

The Resource and Life Cycle Management

In EJB container managing to all the data's , resources like database connections and threads and socket on behalf of enterprise beans. The container creating, destroying, registers the objects and also activates and passivates them. The container is also capable of re-using them whenever required.

Remote Accessibility:

A client on the remote machine containing JVM can invoke an enterprise bean running on the host machine. To support the remote accessibility the container uses the remote procedure call technology. When the software is developed by using the OOPs concept then Remote procedure call (RPC) may be referred to as Remote Method Invocation (RMI).

Concurrency Control:

Concurrency control is necessary to know the basics of collisions and type of collisions that can occur. If you are not interested to occur them then you can bypass them later they will cause to create problems. So try to detect and resolve them. To do so the EJB Container supports for various types of concurrency controls. First we will concentrate on collision and then techniques to resolve these collisions.


A collision can occur when two or more transactions tries to change the entities within a system of records.

Types of Interface in EJB Container:
  1. Dirty read
  2. Non Repeatable read
  3. Phantom read

Control mechanism:

Mainly two mechanism are used to control the concurrency.

  1. Optimistic Locking
  2. Pessimistic Locking

Clustering and load-balancing:

Clustering is the process of combining the multiple peripherals, computers and other resources into a single unit. A clustered system then works as load balanced system. In a distributed system when a request is send to the server, an algorithm running on the server decides which server has less load and sends the request to that server. EJB container encapsulates these features to provide smooth and efficient service.

Previous Home Next