Package org.hibernate

Examples of org.hibernate.StaleObjectStateException


      else if ( isVersionChanged( entity, source, persister, target ) ) {
        if ( source.getFactory().getStatistics().isStatisticsEnabled() ) {
          source.getFactory().getStatisticsImplementor()
              .optimisticFailure( entityName );
        }
        throw new StaleObjectStateException( entityName, id );
      }

      // cascade first, so that all unsaved objects get their
      // copy created before we actually copy
      cascadeOnMerge( source, persister, entity, copyCache );
View Full Code Here


        final int affected = session.getTransactionCoordinator().getJdbcCoordinator().getResultSetReturn().executeUpdate( st );
        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

        //do we even really need this? the update will fail anyway....
        if ( session.getFactory().getStatistics().isStatisticsEnabled() ) {
          session.getFactory().getStatisticsImplementor()
              .optimisticFailure( persister.getEntityName() );
        }
        throw new StaleObjectStateException( persister.getEntityName(), id );
      }
      return snapshot;
    }
    // TODO: optimize away this lookup for entities w/o unsaved-value="undefined"
    final EntityKey entityKey = session.generateEntityKey( id, persister );
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

   * {@inheritDoc}
   */
  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 = getRawSession().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

   * {@inheritDoc}
   */
  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 = getRawSession().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

      else if ( isVersionChanged( entity, source, persister, target ) ) {
        if ( source.getFactory().getStatistics().isStatisticsEnabled() ) {
          source.getFactory().getStatisticsImplementor()
              .optimisticFailure( entityName );
        }
        throw new StaleObjectStateException( entityName, id );
      }
 
      // cascade first, so that all unsaved objects get their
      // copy created before we actually copy
      cascadeOnMerge(source, persister, entity, copyCache);
View Full Code Here

  }

  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 {
View Full Code Here

        }

        int affected = st.executeUpdate();
        if ( affected < 0 ) {
          factory.getStatisticsImplementor().optimisticFailure( lockable.getEntityName() );
          throw new StaleObjectStateException( lockable.getEntityName(), id );
        }

      }
      finally {
        session.getBatcher().closeStatement( st );
View Full Code Here

          if ( !rs.next() ) {
            if ( factory.getStatistics().isStatisticsEnabled() ) {
              factory.getStatisticsImplementor()
                  .optimisticFailure( lockable.getEntityName() );
            }
            throw new StaleObjectStateException( lockable.getEntityName(), id );
          }
        }
        finally {
          rs.close();
        }
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.