|
From: <jue...@we...> - 2004-02-05 07:54:52
|
Alef,
=20
What you're doing here is getting a *new* TransactionStatus for a new =
sub-transaction back: A sub-transaction needs to be committed or =
rollbacked (via mgr.commit/rollback) to be effective.
=20
What you intend is to mark the *current* TransactionStatus =
rollback-only: with TransactionTemplate, you can use the passed-in =
TransactionStatus; with AOP, =
TransactionInterceptor.currentTransactionStatus().
=20
In general, I see hardly any use cases for rolling back without throwing =
an exception anyway. If you want to roll back on checked exception, =
simply specify those in the transaction attributes, e.g. =
"-MyCheckedException".
=20
Juergen
=20
________________________________
Von: spr...@li... im Auftrag =
von Alef Arendsen
Gesendet: Do 05.02.2004 00:27
An: spr...@li...
Betreff: RE: [Springframework-developer] Ready for 1.0 RC1
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 =3D
(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...
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|