Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Transaction attribute Require New in EJB  RSS feed

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a question on EJB's Required New transation attribute.

The book says that Require New means to suspend the client's transaction, and start a new transaction when invoking the method.

My question is, when using a single database, if the client did some updates to the database and then call EJB's method, how the Transaction Manager suspend the client's transaction context?

For Example, the client update the table CUSTOMER, and then call PayEJB.pay(), which has a Required New attribute and the the transaction failed. Would the rollback undo the updates in CUSTOMER?

Thanks!
 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

If the Transaction property is set to Requires New for a method .. then either a commit/rollback inside that method will not affect the transaction in the calling method.

In your example, the update to CUSTOMER table will not be rollbacked.
 
kevin zhou
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.

I'm just wondering the meachism of the Transaction Manager. At this situation, TM may get a new connection from the connection pool, then the previous transaction context could be saved.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!