private SessionFactoryImplementor sfi() { return (SessionFactoryImplementor) getRawSession().getSessionFactory(); }
public boolean isTransactionInProgress() { return ( ( SessionImplementor ) getRawSession() ).isTransactionInProgress(); }
public boolean isTransactionInProgress() { return ( (SessionImplementor) getRawSession() ).isTransactionInProgress(); }
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 PersistenceException wrapStaleStateException(StaleStateException e) { PersistenceException pe; if ( e instanceof StaleObjectStateException ) { StaleObjectStateException sose = (StaleObjectStateException) e; Serializable identifier = sose.getIdentifier(); if (identifier != null) { Object entity = getRawSession().load( sose.getEntityName(), identifier ); if ( entity instanceof Serializable ) { //avoid some user errors regarding boundary crossing pe = new OptimisticLockException( null, e, entity ); } else { pe = new OptimisticLockException( e ); } } else { pe = new OptimisticLockException( e ); } } else { pe = new OptimisticLockException( e ); } return pe; } }
if ( identifier != null ) { try { Object entity = getRawSession().load( sose.getEntityName(), identifier ); if ( entity instanceof Serializable ) {