2.1. Examine session Beans
A session bean encapsulates business logic that can be invoked programmatically by a client over local, remote, or web service client views.
What is a session bean?
2.2. Identify the three types of session beans
- Stateless
- they can support multiple clients
- does not mantain conversational state with the client.
- Stateful
- Mantains conversational state with the client.
- Relationship 1:1 with client.
- Singleton
- new in javaEE6
- is instantiated once per application and exists for the lifecycle of the application (one per application).
- A single enterprise bean needs to be accessed by multiple threads concurrently
2.3. Choose the correct session bean type given a business constraint
- Session stateless - to implement a web service. Transaction-processing applications, which are executed using a procedure call.
- Session stateful - GUI client (filling fields in a GUI needs conversational state)
- Singleton- to implement web service endpoints
2.4. Create session beans package and deploy session beans
The javabeans configuration can be defined with annotations or using an xml deployment descriptor located in :
META-INF/ejb-jar.xml
META-INF/ejb-jar.xml
OCEJBCD (SCBCD) - 1Z0-895 - Enterprise JavaBeans Developer Certification