Package org.hibernate

Examples of org.hibernate.StaleObjectStateException


      if ( !versionType.isEqual(version, currentVersion) ) {
        if ( session.getFactory().getStatistics().isStatisticsEnabled() ) {
          session.getFactory().getStatisticsImplementor()
              .optimisticFailure( persister.getEntityName() );
        }
        throw new StaleObjectStateException( persister.getEntityName(), id );
      }
    }

  }
View Full Code Here


        getVersionType().nullSafeSet( st, nextVersion, 1, session );
        getIdentifierType().nullSafeSet( st, id, 2, session );
        getVersionType().nullSafeSet( st, currentVersion, 2 + getIdentifierColumnSpan(), session );
        int rows = session.getTransactionCoordinator().getJdbcCoordinator().getResultSetReturn().executeUpdate( st );
        if ( rows != 1 ) {
          throw new StaleObjectStateException( getEntityName(), id );
        }
      }
      finally {
        session.getTransactionCoordinator().getJdbcCoordinator().release( st );
      }
View Full Code Here

      if ( !isNullableTable( tableNumber ) ) {
        if ( getFactory().getStatistics().isStatisticsEnabled() ) {
          getFactory().getStatisticsImplementor()
              .optimisticFailure( getEntityName() );
        }
        throw new StaleObjectStateException( getEntityName(), id );
      }
      return false;
    }
    catch( TooManyRowsAffectedException e ) {
      throw new HibernateException(
View Full Code Here

          // todo:  should this instead check for exactly one row modified?
          if ( affected < 0 ) {
            if (factory.getStatistics().isStatisticsEnabled()) {
              factory.getStatisticsImplementor().optimisticFailure( lockable.getEntityName() );
            }
            throw new StaleObjectStateException( lockable.getEntityName(), id );
          }

        }
        finally {
          session.getTransactionCoordinator().getJdbcCoordinator().release( st );
View Full Code Here

      if ( !versionType.isEqual( version, currentVersion ) ) {
        if ( session.getFactory().getStatistics().isStatisticsEnabled() ) {
          session.getFactory().getStatisticsImplementor().optimisticFailure( persister.getEntityName() );
        }
        throw new StaleObjectStateException( persister.getEntityName(), entityKey.getIdentifier() );
      }
    }
  }
View Full Code Here

          if ( !rs.next() ) {
            if ( factory.getStatistics().isStatisticsEnabled() ) {
              factory.getStatisticsImplementor()
                  .optimisticFailure( getLockable().getEntityName() );
            }
            throw new StaleObjectStateException( getLockable().getEntityName(), id );
          }
        }
        finally {
          session.getTransactionCoordinator().getJdbcCoordinator().release( rs, st );
        }
View Full Code Here

          // todo:  should this instead check for exactly one row modified?
          if ( affected < 0 ) {
            if (factory.getStatistics().isStatisticsEnabled()) {
              factory.getStatisticsImplementor().optimisticFailure( lockable.getEntityName() );
            }
            throw new StaleObjectStateException( lockable.getEntityName(), id );
          }

        }
        finally {
          session.getTransactionCoordinator().getJdbcCoordinator().release( st );
View Full Code Here

            if ( !rs.next() ) {
              if ( factory.getStatistics().isStatisticsEnabled() ) {
                factory.getStatisticsImplementor()
                    .optimisticFailure( getLockable().getEntityName() );
              }
              throw new StaleObjectStateException( getLockable().getEntityName(), id );
            }
          }
          finally {
            session.getTransactionCoordinator().getJdbcCoordinator().release( rs, st );
          }
View Full Code Here

  @Override
  public PersistenceException wrapStaleStateException(StaleStateException e) {
    PersistenceException pe;
    if ( e instanceof StaleObjectStateException ) {
      StaleObjectStateException sose = ( StaleObjectStateException ) e;
      Serializable identifier = sose.getIdentifier();
      if ( identifier != null ) {
        try {
          Object entity = internalGetSession().load( sose.getEntityName(), identifier );
          if ( entity instanceof Serializable ) {
            //avoid some user errors regarding boundary crossing
            pe = new OptimisticLockException( null, e, entity );
          }
          else {
View Full Code Here

      if ( !versionType.isEqual(version, currentVersion) ) {
        if ( session.getFactory().getStatistics().isStatisticsEnabled() ) {
          session.getFactory().getStatisticsImplementor()
              .optimisticFailure( persister.getEntityName() );
        }
        throw new StaleObjectStateException( persister.getEntityName(), id );
      }
    }

  }
View Full Code Here

TOP

Related Classes of org.hibernate.StaleObjectStateException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.