EJB includes Session Bean, Entity Bean, and message driven bean, which are implemented based on technologies such as JNDI, RMI, and JTA.
The biggest problem with EJB is not efficiency, but complexity. EJB provides a package of solutions for the business layer and persistent layer, which can provide powerful distributed capabilities for J2EE applications. In Entity Bean, this capability is mainly embodied in Distributed Transaction Management and load balancing. This is the biggest advantage of EJB and its biggest weakness: For applications without distributed requirements, ejbs increase greatly and are of no value.
The following questions help you better understand why EJB is used
1. Distributed problem: If you have several servers that run on the same system, if you write network communication implementation and write a large number of sockets on your own, the complexity will die, and errors will still occur.
2. Transaction problems:
Other problems include multithreading and security.