EJB Features: Enterprise Java Beans Features

Hello Friends, In this blog post(EJB Features), we are going to let you know about the features of enterprise java beans. Before going to the features of EJB you can go with a detailed description of EJB in Hindi here.

Transaction management:

A developer can specify that your enterprise beans need a transactional environment by setting a specific property of the bean you develop.

This means the code inside the enterprise bean would automatically run inside a transaction, which is managed by the EJB infrastructure. That is,…

… you can rest assured that either the entire code in the enterprise bean would be executed completely or none at all. For this, the enterprise bean, in turn, calls an API of the EJB container implicitly.

A software developer does not have to worry about it. Notice that the transaction management applies to the whole bean,…

… and not to any specific error checking within that bean, That is supposed an end of day stock update bean that performs the following two steps:

  1. Read each record (sales/Purchase) from a daily transaction file.
  2. Update the corresponding master file record with the results of the transaction.

Now, when the code of the above operation is ready, the developer could set the transaction enabled property of the bean to true, that is whenever the bean is executed,…

.. the responsibility of making sure that the whole transaction file is processed, and the master file updated correctly, is left to the bean.

If a failure occurs, the bean could automatically roll back the changes done to the master file since the bean was invoked thus ensuring database consistency.

  1. Persistence:

    Persistence means storing the state of an object in some form of permanent storage like a disk, When a developer indicates to the EJB container that he wishes to make an enterprise bean persistence-enabled,…

    .. The EJB container automatically ensures that the last state of the enterprise bean object is preserved on the disk, and later retrieved.

    This is important in situations where an enterprise bean has to store certain values on the server side. For example, suppose a user visits a shopping cart.

Then user disconnects. Now, the state of user transaction can be recorded in a database or the enterprise bean managing the user conversation can store it.

When the user connects back, say after three days, the enterprise bean brings back the values for that user from the disk, so that the user can continue purchasing or complete his purchasing process.

  1. Remote awareness:

    EJB is all about remote objects. Since objects and clients can be in different parts of the world, it is important that all these objects are allowed to communicate over networks. A developer does not have to write any kind of network code to make the enterprise bean that he develops, network-aware/distributed.

    The EJB container automatically does this. This EJB container wraps the enterprise bean in a network-enabled object. This network-enabled object intercepts calls from remote clients and delegates them to the appropriate enterprise bean.
  2. Multi-user support:

    The EJB container implicitly adds the code required for allowing an enterprise bean to work with several clients at the same time.

    It provides built-in support for multithreading, instantiating multiple instances of an enterprise bean whenever needed, etc., automatically.
  3. Location transparency:

    The client of an enterprise application bean does not worry about the actual physical location of the bean. It is handled by the EJB container.

In addition to these, the EJB server is responsible for creating instances of new components, managing database connections, threads, sockets, etc.

In the case of any queries, you can write to us at [email protected] we will get back to you ASAP.

Hope! you would have enjoyed this post about EJB Features.

Please feel free to give your important feedback in the comment section below.

Have a great time!


I am a blogger by passion, a software engineer by profession, a singer by consideration and rest of things that I do is for my destination.