• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

stateful session bean question from head first

 
sid nagol
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • 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
 
Raja Sagar Panamgipalli
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Hi,

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

Thanks,

Regds,
Sagar.
 
Sirajudeen Mohamed
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Hi siraj
thanks for ur time.
it did answer my question
hi sagar, thanks for ur time too,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic