My Testcase is to have two different persistence units. txAdvice can only be set on one JPATransactionManager, and a JPATransactionManager can only be set on one EntityManagerFactory. So i ended having two txAdvice, two JPATransactionManagers and two entityManagerFactories with two datasources.

I found it to be not possible to do a programmatically rollback by using the txadvices. I do set the rollbackOnly via the TransactionAspectSupport.currentTransactionStatus( ).setRollbackOnly() method. But this sets the rollbackOnly !only! on that DefaultTransactionStatus that is bound in the threadlocal context. Depending on the ordering of the txadvice, that might be either the transaction on datasource one or datasource two. Either way, i am not able to set the rollback programmatically on the "outer" transaction.

I understand that this usage of two non-xa datasources might issue some inconstent state. In such a situation, where the commit on the first goes okay, but fails on the second - leaving me no chance to undo the commit on the first. But as i understand it, that is the same case as e.g with Jboss AS using local-tx-datasource.

1) Is the usage of two non-xa datasources not supported in jpa with spring?
2) Is there any way to set the progammatically rollback on each DefaultTransactionStatus?
3) Is it possible to design the tx-advice to allow more than one transaction manager, hence the tx-advice steers all those transactionmanagers? And can it be possibly designed that a jpatransactionmanager holds more than one entitymanagers?
4) Will i have this "unreachable" DefaultTransactionStatus if i use a jcalocaltransactionmanager and a jpatransactionmanager in the same service?