File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes EJB transactions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "EJB transactions" Watch "EJB transactions" New topic
Author

EJB transactions

Richard Tandoh
Greenhorn

Joined: Mar 26, 2004
Posts: 8
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

Joined: Mar 28, 2003
Posts: 11503
    
  95

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


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Richard Tandoh
Greenhorn

Joined: Mar 26, 2004
Posts: 8
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

Joined: Mar 28, 2003
Posts: 11503
    
  95

Hi Richard,
Yes, thats right.
Regards, Andrew
Richard Tandoh
Greenhorn

Joined: Mar 26, 2004
Posts: 8
Thanks again Andrew.
Definitely got the idea.
rt.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB transactions