users@glassfish.java.net

TransactionAttributeType / Required vs Requires_new

From: <glassfish_at_javadesktop.org>
Date: Thu, 15 Jul 2010 11:35:10 PDT

Hi,
I've read quite a bit about the difference between required and requires_new transaction types ; however I'm still confused on a few points.
Largely, I don't see the 'general-practice-pattern' of when REQUIRES_NEW should be used.

I'm aware that "REQUIRED " is the default Transactional attribute applied to Container managed transactions (which I'm currently using). And REQUIRED continues the transaction context, or makes a new one if necessary.

I've read that REQUIRES_NEW involves a lot of overhead to start new transactions (and close / commit changes) and should be avoided - but, I think I've used this in the past to fix a data consistency issue (due to transaction problems).

I don't understand when REQUIRES_NEW would be a wise choice as a TransactionTypeAttribute. Can anyone provide insight or examples when REQUIRES_NEW is a good thing?

Thank you
[Message sent by forum member 'hoffman462']

http://forums.java.net/jive/thread.jspa?messageID=477755