Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB transactions

 
Richard Tandoh
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
I'd appreciate your opinions on this...
Say a method with a transaction attribute of RequiresNew is called by
a method that is already part of a transaction (call it T1). If the
new transaction - created in order to satisfy the RequiresNew
stipulation - (call it T2) is rolled back, will T1 be rolled back too?
Given that EJB only supports flat transactions, it would seem to me
that it would.
Cheers,
rt.
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11945
212
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Richard,
If EJBs supported nested transactions (they don't) then T1 could be rolled back.
But in reality, T1 is suspended by the container before T2 starts. So rolling back T2 should not affect T1.
Regards, Andrew
 
Richard Tandoh
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andrew
Thanks for the reply.
I think I get it now.
As a supplementary, does that mean if the attribute was changed from RequiresNew to Requires, T1 *would* be rolled back because it would have been propagated to the called method - which then rolls back both?
rt.
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11945
212
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Richard,
Yes, thats right.
Regards, Andrew
 
Richard Tandoh
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks again Andrew.
Definitely got the idea.
rt.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic