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

Transaction context in ejbCreate() of a Stateful Session Bean -HFEJB p196

 
Nileesha Bojjawar
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to HFEJB p196, a bean can use the session context to get a transaction reference and call methods on it for BMT beans, If there is any transaction context in ejbCreate why cant we use it to roll back and find if its already set to roll back using the session context for a CMT bean !!
I am all confused about when one can do what bean things?

Please help!!

Thanks
 
Nileesha Bojjawar
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess the transactions for a CMT bean are defined on a method in the DD and the bean will not know about it unless it is in that method execution, in order t oset it to rollback or ask if it is set to rollback only.
please Correct me if what i am thinking is wrong.

Thanks
 
raghu vadranam
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In BMT we can write the Transaction code in ejbCreate.So we can call transaction methods.

But CMT bean is maintained by Container,I think Container won't keep ejbCreate of sessionbean in transaction context so we can't call Transaction methods in CMT session beans.
 
Nileesha Bojjawar
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Raghu,
Thanks for replying.
I think that ejbCreate is in an unspecified Transaction context and hence cannot call specific transaciton functions. I may be wrong .Please correct me.

Cheers
 
Sandesh Tathare
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One can not specify transaction attributes for ejbCreate<METHOD> method of a CMT Session Bean. Please refer to page number 498 of HF EJB.

In short, for CMT Session bean's ejbCreate<METHOD> method, there is no transaction context. Hence, we can not use SessionContext's following methods in ejbCreate<METHOD> method:
1] public void setRollbackOnly()
2] public boolean getRollbackOnly()

Does that answer your doubt?
 
Sandesh Tathare
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
----------------------
One can not specify transaction attributes for ejbCreate<METHOD> method of a CMT Session Bean.

----------------------
When I said above, I am actually talking about create<METHOD> declared in Home interface of Session Bean.
 
Nileesha Bojjawar
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Sandesh,
I think that ejbCreate is a container callback and container executes it in an unspecified transaction context, which is vendor dependent as to how it is implemented.

Regards
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic