Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ejbCreate - EntityBean

 
Fernando Faria
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I was reading Head First EJB and I really don�t understand why is it possible "force a transaction to rollback" or "find out if the transaction has already been set to rollback" in ejbCreate method for EntityBean?
I thought that I don't even to be able to get EJBObject, the "bodyguard". How is it possible for the container to provide transaction services, if ejbCreate is not in a tx context?
Thanks!
Fernando
SCJP, SCWCD
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The container calls ejbCreate() in the transaction context of the client's create(). If the client calls with a transaction context, then it's perfectly legal to invoke the EJBContext's getRollbackOnly() and setRollbackOnly() methods.
 
Fernando Faria
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Roger for your reply
 
Praveena Venigalla
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
----------------------------------------------------------------------------I was reading Head First EJB and I really don�t understand why is it possible "force a transaction to rollback" or "find out if the transaction has already been set to rollback" in ejbCreate method for EntityBean?
I thought that I don't even to be able to get EJBObject, the "bodyguard".
----------------------------------------------------------------------------------------------
Client calls create() method to create a new row in the D.B. So obviously it is tied to the EJBObject.We can call other methods using that EJBObject.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic