• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB2.0 stateful session bean ejbCreate()

 
Srini Krishnan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can another bean's methods and resource manager (like database) be accessed from ejbCreate() for a stateful session bean.Headfirst book (Chapter 4. Page:196)

1) can you please explain the bean things that can be done during ejbCreate(). For example, will ejbCreate() method have a transaction in CMT. If it doesnt have a transaction, then how is able to access another bean's reference and resource manager.
 
Celinio Fernandes
Ranch Hand
Posts: 549
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Operations allowed in a stateful session bean, in the ejbCreate method :

CMT :
SessionContext methods: getEJBHome, getEJBLocalHome, getCallerPrincipal,
isCallerInRole, getEJBObject, getEJBLocalObject
JNDI access to java:comp/env
Resource manager access
Enterprise bean access

BMT :
SessionContext methods: getEJBHome,getEJBLocalHome, getCallerPrincipal,
isCallerInRole, getEJBObject, getEJBLocalObject, getUserTransaction
UserTransaction methods
JNDI access to java:comp/env
Resource manager access
Enterprise bean access

Check the specs for more information.
 
Napu Sun
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At this point, we cannot use CMT. CMT starts when we call methods which have a transaction context. But BMT can be used.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic