Bean things you can do from stateless bean methods

constructor

setSessionContext()

business method

  • nothing

Use your SessionContext to:

Use your SessionContext to:

 

get a reference to your home

get a reference to your home

 

get a reference to your EJB object

get a reference to your EJB object

 

get security information about the client

get security information about the client

 

force a transaction to rollback (CMT beans)

force a transaction to rollback (CMT beans)

 

find out if the transaction has already been set to rollback (CMT beans)

find out if the transaction has already been set to rollback (CMT beans)

 

get a transaction reference, and call methods on it (BMT beans)

get a transaction reference, and call methods on it (BMT beans)

 

Access:

Access:

 

your special JNDI environment

your special JNDI environment

 

another bean’s methods

another bean’s methods

 

a resource manager (like a database)

a resource manager (like a database)

 

ejbCreate(), ejbRemove()

Use your SessionContext to:

  
 

get a reference to your home

Note

Unlike stateFUL beans, a stateLESS bean can’t get caller security info in ejbCreate(), because there IS no client associated with the stateless bean’s creation. Remember, it’s the Container that decides to create the bean, and its not tied to any client.

 

get a reference to your EJB object

  
 

get security information about the client

  
 

force a transaction to rollback (CMT beans)

  
 

find out if the transaction has already been set to rollback (CMT beans)

  
 

get a transaction reference, and call methods on it (BMT beans)

  
 

Access:

     
 

your special JNDI environment

    
 

another bean’s methods

    
 

a resource manager (like a database)

    
image with no caption
image with no caption

Get Head First EJB 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.