Open credmond-git opened 10 months ago
It looks like the older hibernate 5 had something similar to call setRollbackOnly()
@Override
protected void doSetRollbackOnly(DefaultTransactionStatus status) {
HibernateTransactionObject txObject = (HibernateTransactionObject) status.getTransaction();
if (status.isDebug()) {
logger.debug("Setting Hibernate transaction on Session [" +
txObject.getSessionHolder().getSession() + "] rollback-only");
}
txObject.setRollbackOnly();
}
Also DataSourceTransactionManager implements it with a similar flow.
@Override
protected void doSetRollbackOnly(DefaultTransactionStatus status) {
DataSourceTransactionObject txObject = (DataSourceTransactionObject) status.getTransaction();
if (status.isDebug()) {
logger.debug("Setting JDBC transaction [" + txObject.getConnectionHolder().getConnection() +
"] rollback-only");
}
txObject.setRollbackOnly();
}
Describe the bug
When i am in a transaction and it throws an exception, it will catch the exception in
TransactionAspectSupport.invokeWithinTransaction
and try to rollbackThis will eventually call
In other transaction managers such as JpaTransactionManager they set the rollback only flag which seems to cause the transaction to be rolled back.
It would seem like SpannerTransactionManager should implement something similar. I initially filed a bug with Spring issue 31615, they sound happy to help resolve the issue. Related to issues: spring-gcp issue 907
See the callstack below: