Hi Charles, The <tx:transaction... > element will make use of the javax.transaction.TransactionManager service and will commit any transactions that it begins as soon as the method invocation on the bean completes. If you want the transaction to be created outside the bean you should really be using a MANDATORY transaction type for the bean and debugging why the transaction isn't being started (according to the javax.transaction.TransactionManager) before the service is invoked.
Regards, Tim ---------------------------------------- > Date: Wed, 9 Feb 2011 15:41:09 +0100 > Subject: Spring & Aries Tx Manager > From: cmoulli...@gmail.com > To: user@aries.apache.org; d...@aries.apache.org > > Hi, > > I have created a project containing a persistence and service layer. > Transactions demarcations are defined at the level of the service like > this > > > interface="org.apache.camel.example.reportincident.service.IncidentService"/> > > > class="org.apache.camel.example.reportincident.service.impl.IncidentServiceImpl"> > > > > > > interface="org.apache.camel.example.reportincident.dao.IncidentDAO"/> > > > > > Persistence has been defined as presented here after > > > class="org.apache.camel.example.reportincident.dao.impl.IncidentDAOImpl"> > > > > > interface="org.apache.camel.example.reportincident.dao.IncidentDAO"> > > > From a Camel transactional route, I commit or generate a rollback in > case of error. > > > > class="org.apache.camel.spring.spi.SpringTransactionPolicy"> > > > interface="org.springframework.transaction.PlatformTransactionManager"/> > > > > > > > > > > > > java.lang.Exception > > > > > > Services exposed : > > Apache Aries Transaction Manager (1896) provides: > ------------------------------------------------- > org.osgi.service.cm.ManagedServiceFactory > javax.transaction.TransactionManager, > javax.transaction.TransactionSynchronizationRegistry, > javax.transaction.UserTransaction, > org.apache.geronimo.transaction.manager.RecoverableTransactionManager, > org.springframework.transaction.PlatformTransactionManager > > Everything works fine as I'm able from my camel route to call the > service layer (=POJO) and insert data in the MySQL DB. Unfortunately, > when I generate an error and a rollback occurs in camel, this one is > not propagated back and data are inserted. > > Does anybody has a trick to solve this ? > > Regards, > > Charles Moulliard > > Sr. Principal Solution Architect - FuseSource > Apache Committer > > Blog : http://cmoulliard.blogspot.com > Twitter : http://twitter.com/cmoulliard > Linkedin : http://www.linkedin.com/in/charlesmoulliard > Skype: cmoulliard