private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { ois.defaultReadObject(); tx = new TransactionImpl( this ); }
public void setRollbackOnly() { if ( ! isActive() ) throw new IllegalStateException( "Transaction not active" ); this.rollbackOnly = true; }
protected void markAsRollback() { log.debug( "mark transaction for rollback"); if ( tx.isActive() ) { tx.setRollbackOnly(); } else { //no explicit use of the tx. boudaries methods if ( PersistenceUnitTransactionType.JTA == transactionType ) { TransactionManager transactionManager = ( (SessionFactoryImplementor) getRawSession().getSessionFactory() ).getTransactionManager(); if ( transactionManager == null ) { throw new PersistenceException( "Using a JTA persistence context wo setting hibernate.transaction.manager_lookup_class" ); } try { transactionManager.setRollbackOnly(); } catch (SystemException e) { throw new PersistenceException( "Unable to set the JTA transaction as RollbackOnly", e ); } } } }
public void begin() { try { rollbackOnly = false; if ( tx != null && tx.isActive() ) { throw new IllegalStateException( "Transaction already active" ); } //entityManager.adjustFlushMode(); tx = getSession().beginTransaction(); } catch (HibernateException he) { entityManager.throwPersistenceException( he ); } }
protected void markAsRollback() { LOG.debugf("Mark transaction for rollback"); if ( tx.isActive() ) { tx.setRollbackOnly(); } else { //no explicit use of the tx. boundaries methods if ( PersistenceUnitTransactionType.JTA == transactionType ) { TransactionManager transactionManager = sfi().getServiceRegistry().getService( JtaPlatform.class ).retrieveTransactionManager(); if ( transactionManager == null ) { throw new PersistenceException( "Using a JTA persistence context wo setting hibernate.transaction.manager_lookup_class" ); } try { if ( transactionManager.getStatus() != Status.STATUS_NO_TRANSACTION ) { transactionManager.setRollbackOnly(); } } catch ( SystemException e ) { throw new PersistenceException( "Unable to set the JTA transaction as RollbackOnly", e ); } } } }
public void begin() { try { rollbackOnly = false; if ( tx != null && tx.isActive() ) { throw new IllegalStateException( "Transaction already active" ); } //entityManager.adjustFlushMode(); tx = getSession().beginTransaction(); } catch (HibernateException he) { entityManager.throwPersistenceException( he ); } }
public void setRollbackOnly() { if ( ! isActive() ) throw new IllegalStateException( "Transaction not active" ); this.rollbackOnly = true; }
public void begin() { try { rollbackOnly = false; if ( tx != null && tx.isActive() ) { throw new IllegalStateException( "Transaction already active" ); } //entityManager.adjustFlushMode(); tx = getSession().beginTransaction(); } catch (HibernateException he) { entityManager.throwPersistenceException( he ); } }
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { ois.defaultReadObject(); tx = new TransactionImpl( this ); }
public boolean getRollbackOnly() { if ( ! isActive() ) throw new IllegalStateException( "Transaction not active" ); return rollbackOnly; }
public void rollback() { if ( tx == null || !tx.isActive() ) { throw new IllegalStateException( "Transaction not active" ); } try { tx.rollback(); } catch (Exception e) { throw new PersistenceException( "unexpected error when rollbacking", e ); } finally { try { if (entityManager != null) { Session session = getSession(); if ( session != null && session.isOpen() ) session.clear(); } } catch (Throwable t) { //we don't really care here since it's only for safety purpose } rollbackOnly = false; } }
private static Log log = LogFactory.getLog( AbstractEntityManagerImpl.class ); protected transient TransactionImpl tx = new TransactionImpl( this ); protected PersistenceContextType persistenceContextType; private FlushModeType flushModeType = FlushModeType.AUTO;
public boolean getRollbackOnly() { if ( ! isActive() ) throw new IllegalStateException( "Transaction not active" ); return rollbackOnly; }
public void rollback() { if ( tx == null || !tx.isActive() ) { throw new IllegalStateException( "Transaction not active" ); } try { tx.rollback(); } catch (Exception e) { throw new PersistenceException( "unexpected error when rollbacking", e ); } finally { try { if (entityManager != null) { Session session = getSession(); if ( session != null && session.isOpen() ) session.clear(); } } catch (Throwable t) { //we don't really care here since it's only for safety purpose } rollbackOnly = false; } }
protected void markAsRollback() { log.debug( "mark transaction for rollback"); if ( tx.isActive() ) { tx.setRollbackOnly(); } else { //no explicit use of the tx. boudaries methods if ( PersistenceUnitTransactionType.JTA == transactionType ) { TransactionManager transactionManager = ( (SessionFactoryImplementor) getRawSession().getSessionFactory() ).getTransactionManager(); if ( transactionManager == null ) { throw new PersistenceException( "Using a JTA persistence context wo setting hibernate.transaction.manager_lookup_class" ); } try { transactionManager.setRollbackOnly(); } catch (SystemException e) { throw new PersistenceException( "Unable to set the JTA transaction as RollbackOnly", e ); } } } }
public void rollback() { if ( tx == null || !tx.isActive() ) { throw new IllegalStateException( "Transaction not active" ); } try { tx.rollback(); } catch (Exception e) { throw new PersistenceException( "unexpected error when rollbacking", e ); } finally { try { if (entityManager != null) { Session session = getSession(); if ( session != null && session.isOpen() ) session.clear(); } } catch (Throwable t) { //we don't really care here since it's only for safety purpose } rollbackOnly = false; } }