• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

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

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic