- Complex Products
- Unmaintainable System
- Non-portable, frame-work committed business components
- Unpredictable System
- Why EJB 2.0 is complex / complicated?
- Session bean - to write say hello method
in EJB 2.x, you need to write
home interface
component interface
bean
in EJB 3.x, you need to write
interface (with annotation)
bean (with annotation)
EJB 2.x; lookup is the only way to get server object/resource
EJB 3; DI (dependency injection) & lookup are the available way
there are more points. But basically, with EJB 3 responsibility of container is heavy & responsibility of developer is light weight; so that development is less & maintenance is easy.
- Session bean - to write say hello method
The container is responsible for loading, activating, and in general maintaining the "life-cycle" of objects it provides. EJB have a fairly complex life-cycle. There are several kinds of EJB: Session Beans: These may be either stateful or stateless, and are primarily used to encapsulate business logic, carry out tasks on behalf of a client, and act as controllers or managers for other beans. Entity Beans: Entity beans represent persistent objects or business concepts that exist outside a specific application's lifetime. They are typically stored in a relational database. Entity beans can be developed using bean-managed persistence, which is implemented by the developer, or container-managed persistence, implemented by the container. Message-Driven Beans : Message-driven beans listen asynchronously for Java Message Service (JMS) messages from any client or component and are used for loosely coupled, typically batch processing.