Problem solve Get help with specific problems with your technologies, process and projects.

What is the criteria that determines whether to use EJB or not?

What is the criteria that determines whether to use EJB or not? If not using EJB, should we use a simple JavaBean? I heard EJB can slow the performance of the application.
Determining whether or not to use EJB simply on a performance basis can be very illusive. The overall performance of a distributed system is determined by many things, not the least of which is the ability for the system to scale.

EJB provides a modular framework for systems, allowing them to be distributed across many hardware and software platforms solving most scalability needs.

EJB vendors also typically use caching and pooling techniques to handle heavy workloads effectively.

With that said, there are a number of factors aside from scalability to keep in mind when making the decision to use EJBs or not. Some of these are:
  • EJB is a good choice if your system needs transaction management and/or a robust security model.
  • EJB might not be a good choice if your system is anticipated to be handling a low number of users, you are almost exclusively a non-Java shop or you find yourself making architecture decisions around the licensing fees of an EJB container vendor.
If you determine that EJB is not a good choice for you, Java Beans in cooperation with persistence architectures such as JDO are very viable alternatives.

Dig Deeper on Topics Archive