Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session bean ejbCreate method

 
Gan nit
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
According to tHe EJB spec:

"Accessing resource managers and enterprise beans is disallowed in the session bean methods for which the Container does not have a meaningful transaction context or client security context."

How come Resource Manager access and Enterprise bean access are allowed in the ejbCreate, ejbRemove, ejbActivate and ejbPassivate methods on a STATEFUL session bean. THe spec also says:

"The getRollbackOnly and setRollbackOnly methods of the SessionContext interface should be used only in the session bean methods that execute in the context of a transaction. SInce the ejbCreate, ejbRemove, ejbActivate and ejbPassivate methods of a STATEFUL session bean execute in an unspecified transaction context the getRollbackOnly and setRollbackOnly methods should not be called from these methods."

If the ejbCreate, ejbRemove, ejbActivate and ejbPassivate methods of a STATEFUL session bean execute in an unspecified transaction context, how can they be allowed to access the Resource Manager and other Enterprise beans?

Please clarify.


Thanks very much,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic