Dude i think you are asking to much from Hibernate. Standard JTA implementation in JBoss 4.0.3SP1 doesn't support PROPAGATION_NESTED.
Take a look into
http://jira.jboss.com/jira/browse/JBAS-3364 and
http://jira.jboss.com/jira/browse/HIBERNATE-41
I'm currently trying to find a way of how to avoid HIBERNATE-41 in our code. I downloaded and installed latest JBossTS which declares support nested transactions JTA/JTS from
http://labs.jboss.com/portal/jbosstm/downloads.
But in fact this Arjuna sh..t doesn't really nest them. The provided semantic has nothing to do with PROPAGATION_NESTED it rather looks like you call a non-transactional method within a transactional method.
Here is what i mean:
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.
[ Show » ] Yegor Yenikyeyev [07/Jul/06 05:14 AM] 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.