Win a copy of Terraform in Action this week in the Cloud forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

stateful session bean question from head first

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi i am unable to understand the following ingo from Head First book
page 196

In stateful session beans
why does ejb activate, ejbremove, ejbpassivate, ejbcreate cannot do cmt(container managed transaction) transaction METHODS.
(SessionContext.setRollBackOnly, SessionContext.setRollbackOnly are not allowed)

but why can it do bmt transaction roll backs, (u can get
SessionContext.getUserTransaction().start(),
SessionContext.getUserTransaction().commit(), ... etc is allowed)

CAN U GIVE ME SOME EXAMPLE, THAT WOULD BE GREAT.
THANK YOU FOR YOUR TIME AND I REALLY APPRECIATE IT.

THANKS
SID
 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Can you be more specific and clear in your query...

Thanks,

Regds,
Sagar.
 
Raja Sagar Panamgipalli
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Can you be more specific and clear in your query...

Thanks,

Regds,
Sagar.
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sid,
For a stateful session bean, the ejbCreate() runs inside unspecified transaction context(thats the reason no need to specify transaction attributes for session bean home interface, however its required for Entity bean). When there is no transaction context, there is no use for those 2 methods setRollbackOnly() and getRollbackOnly(). However using BMT, you can start your own transaction using the getUserTransaction() method from SessionContext interface. Hope this helps you.

Thanks
Siraj
 
sid nagol
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi siraj
thanks for ur time.
it did answer my question
hi sagar, thanks for ur time too,
 
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