Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

StateFUL - why allow BMT in activate()/passivate() ?

 
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to HFB p.206, Stateful SB will not run ejbActivate()/ejbPassivate() when the bean is in transaction.

What's the purpose of calling ctx.getUserTransaction() (BMT beans) in ejbPassivate() / ejbActivate() ? - HFB p. 207.

In the ejbPassivate() / ejbActivate(), why we CANNOT run CMT transaction methods (force tx to rollback, find out if a tx is rollede back) while we CAN run BMT trasaction methods ?

Thanks ~
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Vince Hon:
According to HFB p.206, Stateful SB will not run ejbActivate()/ejbPassivate() when the bean is in transaction.

What's the purpose of calling ctx.getUserTransaction() (BMT beans) in ejbPassivate() / ejbActivate() ? - HFB p. 207.

In the ejbPassivate() / ejbActivate(), why we CANNOT run CMT transaction methods (force tx to rollback, find out if a tx is rollede back) while we CAN run BMT trasaction methods ?

Thanks ~


Hi! I think this has something to do when the transaction was started. When a bean is executing a method that is in a transaction PRIOR to passivation, then ejbPassivate() and ejbActivate() will never be called since the bean never gets passivated in the first place. But if a bean is not in a transaction then it gets passivated, you may start a transaction within your ejbPassivate() or ejbActivate() methods.

I hope that helps!
 
PI day is 3.14 (march 14th) and is also einstein's birthday. And this is merely a 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