private void checkTransactionNeeded() { if ( persistenceContextType == PersistenceContextType.TRANSACTION && ! isTransactionInProgress() ) { //no need to mark as rollback, no tx in progress throw new TransactionRequiredException( "no transaction is in progress for a TRANSACTION type persistence context" ); } }
private void checkTransactionNeeded() { if ( persistenceContextType == PersistenceContextType.TRANSACTION && !isTransactionInProgress() ) { //no need to mark as rollback, no tx in progress throw new TransactionRequiredException( "no transaction is in progress for a TRANSACTION type persistence context" ); } }
public void flush() { try { if ( ! isTransactionInProgress() ) { throw new TransactionRequiredException( "no transaction is in progress" ); } //adjustFlushMode(); getSession().flush(); } catch (HibernateException he) { throwPersistenceException( he ); } }
public void flush() { if ( !isTransactionInProgress() ) { throw new TransactionRequiredException( "no transaction is in progress" ); } try { getSession().flush(); } catch ( RuntimeException e ) { throw convert( e ); } }
public void lock(Object entity, LockModeType lockMode) { try { if ( ! isTransactionInProgress() ) { throw new TransactionRequiredException( "no transaction is in progress" ); } //adjustFlushMode(); if ( !contains( entity ) ) throw new IllegalArgumentException( "entity not in the persistence context" ); getSession().lock( entity, getLockMode( lockMode ) ); } catch (HibernateException he) { throwPersistenceException( he ); } }
public void lock(Object entity, LockModeType lockModeType, Map<String, Object> properties) { LockOptions lockOptions = null; if ( !isTransactionInProgress() ) { throw new TransactionRequiredException( "no transaction is in progress" ); } try { if ( !contains( entity ) ) { throw new IllegalArgumentException( "entity not in the persistence context" ); } getSession().buildLockRequest( ( lockOptions = getLockRequest( lockModeType, properties ) ) ) .lock( entity ); } catch ( HibernateException he ) { throw convert( he, lockOptions ); } }