Closed credmond-git closed 12 months ago
which throws the error
throw new IllegalTransactionStateException( "Participating in existing transactions is not supported - when 'isExistingTransaction' " + "returns true, appropriate 'doSetRollbackOnly' behavior must be provided");
What concrete AbstractPlatformTransactionManager
sub-type are you using?
As far as I know, all concrete implementations in the core Spring Framework override doSetRollbackOnly()
, meaning that particular exception will not be thrown.
I am using SpannerTransactionManager it looks like there was a ticket previously but it was closed without fixing. Never mind that was for Datastore not Spanner. Do you have any details i could provide for google to open a new issue?
@credmond-git report this against the Google Cloud project and we can assist them if they have any question. Make sure to add a link to this issue so that they can follow along.
Affects: 6.0.13
I am using spanner with JPA, and when i am in a transaction where there is a bug and an exception is thrown I would expect the exception message to show the cause of the original bug with a callstack. However it is lost.
Inside
TransactionAspectSupport.invokeWithinTransaction(...)
, we get to theinvocation.proceedWithInvocation()
, where an exception is thrown.This causes the
completeTransactionAfterThrowing(txInfo, ex);
to be triggered.which follows the call stack to doSetRollbackOnly:1207,
AbstractPlatformTransactionManager
:which throws the error
Now instead of rethrowing the exception i am interested in that was caught in
i lose that exception and get the
IllegalTransactionStateException
with all the exception details lost.I probably have a bug in my code that is causing the
IllegalTransactionStateException
to happen, but either way we should preserve the causing exception. We could catch theIllegalTransactionStateException
and log it then the causingThrowable ex
as well as theIllegalTransactionStateException
or vise versa.