public void afterCompletion(int status) { boolean success = Status.STATUS_COMMITTED == status; getSynchronizations().afterTransactionCompletion(success); rollbackOnly = false; synchronizationRegistered = false; }
public void beforeCompletion() { getSynchronizations().beforeTransactionCommit(); }
public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, IllegalStateException, SystemException { log.debug("committing JPA resource-local transaction"); Transaction delegate = getDelegate(); boolean success = false; boolean tempSynchronizationRegistered = synchronizationRegistered; try { if (delegate.isActive()) { if (!rollbackOnly) { if (!tempSynchronizationRegistered) { // should only occur if the user started the transaction // directly through the session getSynchronizations().beforeTransactionCommit(); } delegate.commit(); success = true; } else { rollback(); } } } finally { if (!tempSynchronizationRegistered) { getSynchronizations().afterTransactionCompletion(success); } } }
public void rollback() throws IllegalStateException, SecurityException, SystemException { log.debug("rolling back JPA resource-local transaction"); // TODO: translate exceptions that occur into the correct JTA exception Transaction delegate = getDelegate(); rollbackOnly = false; boolean tempSynchronizationRegistered = synchronizationRegistered; delegate.rollback(); if (!tempSynchronizationRegistered) { getSynchronizations().afterTransactionCompletion(false); } }
public void begin() throws NotSupportedException, SystemException { log.debug("beginning JPA resource-local transaction"); // TODO: translate exceptions that occur into the correct JTA exception try { getDelegate().begin(); getSynchronizations().afterTransactionBegin(); // use hibernate to manage the synchronizations // that way even if the user commits the transaction // themselves they will still be handled getDelegate().registerSynchronization(this); synchronizationRegistered = true; } catch (RuntimeException re) { throw re; } }