List of usage examples for javax.persistence EntityTransaction equals
public boolean equals(Object obj)
From source file:org.eclipse.jubula.client.core.persistence.Persistor.java
/** * @param s/*from w w w . ja va 2s . c om*/ * Session which is used for the transaction * @param tx * transaction to rollback * @throws PMException * in case of failed rollback */ public void rollbackTransaction(EntityManager s, EntityTransaction tx) throws PMException { Validate.notNull(s); if (tx != null) { // FIXME NLS Validate.isTrue(tx.equals(s.getTransaction()), "Session and Transaction don't match"); //$NON-NLS-1$ try { tx.rollback(); } catch (PersistenceException e) { log.error(Messages.RollbackFailed, e); if (s.equals(GeneralStorage.getInstance().getMasterSession())) { GeneralStorage.getInstance().recoverSession(); } throw new PMException(Messages.RollbackFailed, MessageIDs.E_DATABASE_GENERAL); } finally { removeLocks(s); } } }
From source file:org.eclipse.jubula.client.core.persistence.Persistor.java
/** * @param s/* w ww . j a v a2 s . c om*/ * session * @param tx * transaction * @throws PMReadException * {@inheritDoc} * @throws PMAlreadyLockedException * {@inheritDoc} * @throws PMDirtyVersionException * {@inheritDoc} * @throws PMException * {@inheritDoc} * @throws ProjectDeletedException * if the project was deleted in another instance */ public void commitTransaction(EntityManager s, EntityTransaction tx) throws PMReadException, PMAlreadyLockedException, PMDirtyVersionException, PMException, ProjectDeletedException { Validate.notNull(s); Validate.notNull(tx); Validate.isTrue(tx.equals(s.getTransaction()), Messages.SessionAndTransactionDontMatch); try { tx.commit(); } catch (PersistenceException e) { if (s != null && s.equals(GeneralStorage.getInstance().getMasterSession())) { PersistenceManager.handleDBExceptionForMasterSession(null, e); } else { PersistenceManager.handleDBExceptionForAnySession(null, e, s); } } finally { removeLocks(s); } }