Session Beans

Stateless Session Beans

Life-cycle state diagram of the stateless session bean

Figure B-6. Life-cycle state diagram of the stateless session bean

Creation and removal of stateless session beans

Figure B-7. Creation and removal of stateless session beans

Table B-2 summarizes the operations that are legal for a stateless session bean. The allowed operations are the same for both EJB 2.0 and 1.1, except for the SessionContext methods getEJBLocalHome() and getEJBLocalObject(), which are specific to EJB 2.0.

Table B-2. Allowed operations for stateless session beans

Method

Allowed operations

 

Container-managed transactions

Bean-managed transactions

ejbCreate()

ejbRemove()

EntityContext methods:

getEJBHome()

getEJBLocalHome()

getEJBObject()

getEJBLocalObject()

JNDI ENC contexts:

Properties: java:comp/env

EntityContext methods:

getEJBHome()

getEJBLocalHome()

getEJBObject()

getEJBLocalObject()

getUserTransaction()

JNDI ENC contexts:

Properties: java:comp/env

Business methods

EntityContext methods:

getEJHome()

getEJBLocalHome()

getCallerPrincipal()

isCallerInRole()

getRollbackOnly()

setRollbackOnly()

getEJBObject()

getEJBLocalObject()

JNDI ENC contexts:

Properties: java:comp/env

Resource managers: java:comp/env/jdbc

EJB references: java:comp/env/ejb

EntityContext methods:

getEJHome()

getEJBLocalHome()

getCallerPrincipal() ...

Get Enterprise JavaBeans, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.