|
From: Colin S. <col...@ex...> - 2004-02-05 00:09:00
|
The current transaction is just attached to the Thread via the DataSource. The lowest-hanging fruit is to first of all step through the getTransaction call in AbstractPlatformTransactionManager and verify that in fact you are getting back the current transaction off the current thread. In the case of feeding it the null TransactionDefinition, the code path is very simple, so I doubt that is where it's failing, but you can verify. If that is ok, step through the commit call and see if it's actually getting the same TransactionStatus object it created before, and it has the rollback flag on like it should... > <pre wrap>There's an issue that just came up with the > TransactionManager. I > haven't spend enough time on it to fully figure it out, but before I dig > into it further, maybe you guys can give an opinion: > > When using a DataSourceTransactionManager, in a bean I'm asking the > applicationcontext for the transactionmanager. After calling > setRollbackOnly() is doesn't rollback. I've reproduced this using > petclinic, by implementing ApplicationContextAware in AbstractJdbcClinic > and in one of the store*** methods calling: > > PlatformTransactionManager mgr = > (PlatformTransactionManager)appCtx.getBean( > "transactionManager"); > // does this give me the current transaction??? > mgr.getTransaction(null).setRollbackOnly(); > > AFAIK this should result in a rollback, shouldn't it... > > Thanx, > > Alef > > P.s. we're doing this because of some legacy code that needs to rollback > as well. We can't reimplement it right now... |