|
From: <jue...@we...> - 2004-02-16 07:06:04
|
Good point - I can't remember why I wrote it that way; probably some =
misguided attempt at optimization. Anyway, I changed it to just check =
for STATUS_NO_TRANSACTION.
=20
Juergen
=20
________________________________
Von: spr...@li... im Auftrag =
von Colin Sampaleanu
Gesendet: Sa 14.02.2004 22:39
An: spr...@li...
Betreff: [Springframework-developer] JTATransactionManager =
isExistingTransaction() logic
Juerge,
In JTATransactionManager, you've got:
protected boolean isExistingTransaction(Object transaction) {
try {
int status =3D ((UserTransaction) transaction).getStatus();
return (status !=3D Status.STATUS_NO_TRANSACTION && status =
!=3D
Status.STATUS_MARKED_ROLLBACK);
}
catch (SystemException ex) {
throw new TransactionSystemException("JTA failure on
getStatus", ex);
}
}
I'm wondering why you lumped together STATUS_NO_TRANSACTION and
STATUS_MARKED_ROLLBACK.
In some code I'm running, inside an EJB demarcated transaction, a
third-party EJB did a setRollbakOnly() on it's context. Then in a
subsequent step, still inside that rollback-marked exception, my spring
based code tried to execute something through a transactionally wrapped
POJO. What happened is that Spring then thought (because of the above
code) that there was no transaction, and tried to initiate one. At that
point I got an exception from the JBoss Transaction Manager that it
didin't support nested transactions. Now in this case, either way
everything fails. But I think it would be more correct to treat the
marked for rollback case as 'there is an existing transaction'. If the
JTA Transaction manager in the container actually supported nested
transactions, the above code would allow the spring code to execute in a
new tranasaction, when it in fact should just join the (marked for
rollback) existing transaction.
Regards,
Colin
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=3D1356&alloc_id=3D3438&op=3Dclick
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|