Package org.hibernate

Examples of org.hibernate.AssertionFailure


            }
          }
      );
    }
    catch ( Exception e ) {
      throw new AssertionFailure("could not init listeners");
    }
  }
View Full Code Here


      );
    }

    EntityEntry entry = getSession().getPersistenceContext().getEntry( instance );
    if ( entry == null ) {
      throw new AssertionFailure( "possible nonthreadsafe access to session" );
    }
   
    if ( entry.getStatus()==Status.MANAGED || persister.isVersionPropertyGenerated() ) {
      // get the updated snapshot of the entity state by cloning current state;
      // it is safe to copy in place, since by this time no-one else (should have)
View Full Code Here

    // exists on the database (needed for identity-column key generation), and
    // remove it from the session cache
    final PersistenceContext persistenceContext = session.getPersistenceContext();
    EntityEntry entry = persistenceContext.removeEntry( instance );
    if ( entry == null ) {
      throw new AssertionFailure( "possible nonthreadsafe access to session" );
    }
    entry.postDelete();

    EntityKey key = new EntityKey( entry.getId(), entry.getPersister(), session.getEntityMode() );
    persistenceContext.removeEntity(key);
View Full Code Here

          if ( ownerEntry != null ) {
            ownerId = ownerEntry.getId();
          }
        }
        if ( ownerId == null ) {
          throw new AssertionFailure( "Unable to determine collection owner identifier for orphan-delete processing" );
        }
      }
      EntityKey key = new EntityKey(
          ownerId,
              loadedPersister.getOwnerEntityPersister(),
              session.getEntityMode()
      );
      Object owner = persistenceContext.getEntity(key);
      if ( owner == null ) {
        throw new AssertionFailure(
            "collection owner not associated with session: " +
            loadedPersister.getRole()
        );
      }
      EntityEntry e = persistenceContext.getEntry(owner);
View Full Code Here

          EntityMode entityMode,
          SessionFactoryImplementor factory)
  throws HibernateException {

    if ( entry.isProcessed() ) {
      throw new AssertionFailure( "collection was processed twice by flush()" );
    }
    entry.setProcessed(true);

    final CollectionPersister loadedPersister = entry.getLoadedPersister();
    final CollectionPersister currentPersister = entry.getCurrentPersister();
View Full Code Here

  private CallableStatement getCallableStatement(
      final Connection conn,
          String sql,
          boolean scrollable) throws SQLException {
    if ( scrollable && !factory.getSettings().isScrollableResultSetsEnabled() ) {
      throw new AssertionFailure("scrollable result sets are not enabled");
    }

    sql = getSQL( sql );
    log( sql );
View Full Code Here

  }

  private String getSQL(String sql) {
    sql = interceptor.onPrepareStatement( sql );
    if ( sql==null || sql.length() == 0 ) {
      throw new AssertionFailure( "Interceptor.onPrepareStatement() returned null or empty string." );
    }
    return sql;
  }
View Full Code Here

          final boolean useGetGeneratedKeys,
          final String[] namedGeneratedKeys,
          final ScrollMode scrollMode,
          final boolean callable) throws SQLException {
    if ( scrollable && !factory.getSettings().isScrollableResultSetsEnabled() ) {
      throw new AssertionFailure("scrollable result sets are not enabled");
    }
    if ( useGetGeneratedKeys && !factory.getSettings().isGetGeneratedKeysEnabled() ) {
      throw new AssertionFailure("getGeneratedKeys() support is not enabled");
    }

    sql = getSQL( sql );
    log( sql );
View Full Code Here

        final Serializable id,
        final boolean emptySnapshot,
        final SessionImplementor session)
      throws CacheException {
    super( persister, collection, id, session );
    if (collection == null) { throw new AssertionFailure("collection == null"); }
    this.emptySnapshot = emptySnapshot;
    // the loaded owner will be set to null after the collection is removed,
    // so capture its value as the affected owner so it is accessible to
    // both pre- and post- events
    this.affectedOwner = session.getPersistenceContext().getLoadedCollectionOwnerOrNull( collection );
View Full Code Here

        final Serializable id,
        final boolean emptySnapshot,
        final SessionImplementor session)
      throws CacheException {
    super( persister, null, id, session );
    if (affectedOwner == null) { throw new AssertionFailure("affectedOwner == null"); }
    this.emptySnapshot = emptySnapshot;
    this.affectedOwner = affectedOwner;
  }
View Full Code Here

TOP

Related Classes of org.hibernate.AssertionFailure

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.