// all change sets and are cleared, but the cache is
// kept
this.wrapper.localUOW.clearForClose(false);
}
} else {
throw new RollbackException(ExceptionLocalization.buildMessage("rollback_because_of_rollback_only"));
}
}
} catch (RuntimeException exception) {
try {
if (this.wrapper.localUOW != null) {
this.wrapper.getEntityManager().removeExtendedPersistenceContext();
this.wrapper.localUOW.release();
this.wrapper.localUOW.getParent().release();
}
} catch (Exception ignore) {} // Throw first exception.
if (exception instanceof RollbackException) {
throw exception;
} else if (exception instanceof org.eclipse.persistence.exceptions.OptimisticLockException) {
throw new RollbackException(new javax.persistence.OptimisticLockException(exception));
} else {
throw new RollbackException(exception);
}
} finally {
this.active = false;
this.rollbackOnly = false;
this.wrapper.setLocalUnitOfWork(null);