What are the different types of enterprise beans available in EJB 3.x?


What are the different types of enterprise beans available in EJB 3.x?

Ninja Asked on 18th September 2018 in EJB 3.x.
Add Comment
1 Answer(s)
Best answer

There are two types of enterprise beans defined in EJB 3.x:

    1. Session Bean – Performs a task for a client, encapsulates the business logic of the application. Session beans are of three types:

              (a). Stateless Session Bean: A stateless session bean does not maintain a conversational state with the client. When a client invokes the methods of a stateless bean, the bean’s instance variables may contain a state specific to that client but only for the duration of the invocation. When the method is finished, the client-specific state should not be retained.

             (b). Stateful Session Bean: In a stateful session bean, the instance variables represent the state of a unique client/bean session. If the client completes all the operations on the bean, the session ends and the state disappears.

             (c). Singleton Session Bean: A singleton session bean is instantiated once per application and exists for the lifecycle of the application. Singleton session beans are designed for circumstances in which a single enterprise bean instance is shared across and concurrently accessed by clients.

    1. Message Driven Bean – Acts as an asynchronous message consumer. This type of bean normally acts as a JMS (Java Message Service) message listener.
Ninja Answered on 18th September 2018.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.