|
From: Alef A. <al...@jt...> - 2004-02-06 12:25:07
|
TransactionInterceptor.currentTransactionStatus() seems to work with the petclinic example. However, it does not work here, but that=92s our = problem... Thanx, Alef > -----Original Message----- > From: spr...@li... > [mailto:spr...@li...] On = Behalf > Of j=FCrgen h=F6ller [werk3AT] > Sent: Thursday, February 05, 2004 8:54 AM > To: spr...@li... > Subject: Re: [Springframework-developer] Ready for 1.0 RC1 >=20 > 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 >=20 > ________________________________ >=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 >=20 >=20 >=20 > 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: >=20 > 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: >=20 > PlatformTransactionManager mgr =3D > (PlatformTransactionManager)appCtx.getBean( > "transactionManager"); > // does this give me the current transaction??? > mgr.getTransaction(null).setRollbackOnly(); >=20 > AFAIK this should result in a rollback, shouldn't it... >=20 > Thanx, >=20 > Alef >=20 > P.s. we're doing this because of some legacy code that needs to = rollback > as well. We can't reimplement it right now... >=20 >=20 >=20 > ------------------------------------------------------- > 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 >=20 >=20 >=20 >=20 > ------------------------------------------------------- > 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 |