I tried to figure out about nested transactions as a replacement for REQUIRES_NEW in my test case. Scott M Stark helped me to realize that latest JBossTS declares support of nested trans.
Unfortunatelly the latest implementation of JBossTS from
http://labs.jboss.com/portal/jbosstm/downloads doesn't implement PROPAGATION_NESTED transaction semantic. Tested versions: JBoss 4.0.3SP1, jbossts-jta-4.2.1Beta1.zip, Hibernate 3.2CR2, TreeCache 1.3.0SP2, JDBC3.0 compliant driver and PostgreSQL 8.0.2
Here is a sample illustrating my point:
(1) I start global tx1 from Spring method call f1() with PROPAGATION_REQUIRED. It registered in gtx table with number 1
(2) tx1 got associated with an opened Hibernate session
(3) invokes Hibernate DAOs to load some domain objects
(4) tx1 calls f2() with PROPAGATION_NESTED
(4.2) No new transaction created in gtx
(5) f2 invokes Hibernate DAO to load 1 domain O1 object and resave it with 1 field updated.
(6) After f2 exit and execution point is back in f1() no commit done for O1 and no record data flushed to DB.
Expected behavior is that after step 5 the nested transaction will be commited and hibernate session object O1 (modified within f2) call will be flushed and DB record updated.