One doubt in "Operations Allowed in the Methods of a Session Bean".
From my understanding PostConstruct, Pre-Destroy, PrePassivate,PostActivate callback methods run in a unspecified Transaction Context. So Resource manager access and Enterprise bean access should not be allowed in these methods.
If I see the tables (Table1-page 74 and Table2-page 82 ) from ejb-3_0-pr-spec-ejbcore.pdf spec, there are some differences.
For Statefull Session beens
Operations allowed in PostConstruct, Pre-Destroy, PrePassivate,PostActivate are 1. SessionContext methods: getBusinessObject,getEJBHome, getEJBLocalHome, getCallerPrincipal,isCallerInRole, getEJBObject, getEJBLocalObject 2. JNDI access to java:comp/env 3. Resource manager access 4. Enterprise bean access
For Stateless Session beens Operations allowed in PostConstruct, Pre-Destroy are
As we know all the above methods are running in unspecified transaction. Why Resource manager access and Enterprise bean access are allowed in Statefull session bean? Can any body please help me to understand the difference here?
Resource manager access and Enterprise bean access are allowed if methods are running in a meaningful transaction or have a client security context. Since stateful session beans have a client associated when these methods are called, although not in transaction, the access to resources is allowed.
Stateless beans do not have client associated in these methods so access to resources are not allowed.
Even I had difficulty understanding these concepts but this is the way I understood them.
Hope this helps, Mini
joke time: What is brown and sticky? ... ... ... A stick! Use it to beat this tiny ad!