/** * JTA {@code beforeCompletion} callback: just invoked before commit. * <p>In case of an exception, the JTA transaction will be marked as rollback-only. * @see org.springframework.transaction.support.TransactionSynchronization#beforeCommit */ @Override public void beforeCompletion() { try { boolean readOnly = TransactionSynchronizationManager.isCurrentTransactionReadOnly(); this.springSynchronization.beforeCommit(readOnly); } catch (RuntimeException | Error ex) { setRollbackOnlyIfPossible(); throw ex; } finally { // Process Spring's beforeCompletion early, in order to avoid issues // with strict JTA implementations that issue warnings when doing JDBC // operations after transaction completion (e.g. Connection.getWarnings). this.beforeCompletionCalled = true; this.springSynchronization.beforeCompletion(); } }
new SpringJtaSynchronizationAdapter( new SpringSQLSessionSynchronization(holderToUse, sessionFactory, jdbcExceptionTranslator, true), jtaTm));
new SpringJtaSynchronizationAdapter( new SpringSessionSynchronization(holderToUse, sessionFactory, jdbcExceptionTranslator, true), jtaTm));
/** * JTA {@code beforeCompletion} callback: just invoked before commit. * <p>In case of an exception, the JTA transaction will be marked as rollback-only. * @see org.springframework.transaction.support.TransactionSynchronization#beforeCommit */ @Override public void beforeCompletion() { try { boolean readOnly = TransactionSynchronizationManager.isCurrentTransactionReadOnly(); this.springSynchronization.beforeCommit(readOnly); } catch (RuntimeException | Error ex) { setRollbackOnlyIfPossible(); throw ex; } finally { // Process Spring's beforeCompletion early, in order to avoid issues // with strict JTA implementations that issue warnings when doing JDBC // operations after transaction completion (e.g. Connection.getWarnings). this.beforeCompletionCalled = true; this.springSynchronization.beforeCompletion(); } }
sessionHolder.addSession(jtaTx, session); jtaTx.registerSynchronization( new SpringJtaSynchronizationAdapter( new SpringSQLSessionSynchronization(sessionHolder, sessionFactory, jdbcExceptionTranslator, false), jtaTm));
/** * JTA {@code beforeCompletion} callback: just invoked before commit. * <p>In case of an exception, the JTA transaction will be marked as rollback-only. * @see org.springframework.transaction.support.TransactionSynchronization#beforeCommit */ @Override public void beforeCompletion() { try { boolean readOnly = TransactionSynchronizationManager.isCurrentTransactionReadOnly(); this.springSynchronization.beforeCommit(readOnly); } catch (RuntimeException ex) { setRollbackOnlyIfPossible(); throw ex; } catch (Error err) { setRollbackOnlyIfPossible(); throw err; } finally { // Process Spring's beforeCompletion early, in order to avoid issues // with strict JTA implementations that issue warnings when doing JDBC // operations after transaction completion (e.g. Connection.getWarnings). this.beforeCompletionCalled = true; this.springSynchronization.beforeCompletion(); } }
sessionHolder.addSession(jtaTx, session); jtaTx.registerSynchronization( new SpringJtaSynchronizationAdapter( new SpringSessionSynchronization(sessionHolder, sessionFactory, jdbcExceptionTranslator, false), jtaTm));
/** * JTA {@code beforeCompletion} callback: just invoked before commit. * <p>In case of an exception, the JTA transaction will be marked as rollback-only. * @see org.springframework.transaction.support.TransactionSynchronization#beforeCommit */ @Override public void beforeCompletion() { try { boolean readOnly = TransactionSynchronizationManager.isCurrentTransactionReadOnly(); this.springSynchronization.beforeCommit(readOnly); } catch (RuntimeException ex) { setRollbackOnlyIfPossible(); throw ex; } catch (Error err) { setRollbackOnlyIfPossible(); throw err; } finally { // Process Spring's beforeCompletion early, in order to avoid issues // with strict JTA implementations that issue warnings when doing JDBC // operations after transaction completion (e.g. Connection.getWarnings). this.beforeCompletionCalled = true; this.springSynchronization.beforeCompletion(); } }