Package org.hibernate

Examples of org.hibernate.AssertionFailure


  public final Serializable[] getPropertySpaces() {
    return persister.getPropertySpaces();
  }

  public void beforeExecutions() {
    throw new AssertionFailure( "beforeExecutions() called for non-collection action" );
  }
View Full Code Here


     
      persister.insert( id, state, instance, session );
   
      EntityEntry entry = session.getPersistenceContext().getEntry( instance );
      if ( entry == null ) {
        throw new AssertionFailure( "possible nonthreadsafe access to session" );
      }
     
      entry.postInsert();
 
      if ( persister.hasInsertGeneratedProperties() ) {
View Full Code Here

    else {
      copyCache.put(entity, result); //before cascade!
 
      final Object target = source.getPersistenceContext().unproxy(result);
      if ( target == entity ) {
        throw new AssertionFailure("entity was not detached");
      }
      else if ( !source.getEntityName(target).equals(entityName) ) {
        throw new WrongClassException(
            "class of the given object did not match class of persistent copy",
            event.getRequestedId(),
View Full Code Here

   * @throws HibernateException
   */
  public void checkUniqueness(EntityKey key, Object object) throws HibernateException {
    Object entity = getEntity(key);
    if ( entity == object ) {
      throw new AssertionFailure( "object already associated, but no entry was found" );
    }
    if ( entity != null ) {
      throw new NonUniqueObjectException( key.getIdentifier(), key.getEntityName() );
    }
  }
View Full Code Here

    collectionEntries.put( coll, entry );
    CollectionKey collectionKey = new CollectionKey( entry.getLoadedPersister(), key, session.getEntityMode() );
    PersistentCollection old = ( PersistentCollection ) collectionsByKey.put( collectionKey, coll );
    if ( old != null ) {
      if ( old == coll ) {
        throw new AssertionFailure("bug adding collection twice");
      }
      // or should it actually throw an exception?
      old.unsetSession( session );
      collectionEntries.remove( old );
      // watch out for a case where old is still referenced
View Full Code Here

  public void postFlush(PersistentCollection collection) throws HibernateException {
    if ( isIgnore() ) {
      ignore = false;
    }
    else if ( !isProcessed() ) {
      throw new AssertionFailure( "collection [" + collection.getRole() + "] was not processed by flush()" );
    }
    collection.setSnapshot(loadedKey, role, snapshot);
  }
View Full Code Here

   * Get the collection orphans (entities which were removed from the collection)
   */
  public Collection getOrphans(String entityName, PersistentCollection collection)
  throws HibernateException {
    if (snapshot==null) {
      throw new AssertionFailure("no collection snapshot for orphan delete");
    }
    return collection.getOrphans( snapshot, entityName );
  }
View Full Code Here

      if ( original == target ) {
        return target;
      }
      Object id = getIdentifier( original, session );
      if ( id == null ) {
        throw new AssertionFailure("cannot copy a reference to an object with a null id");
      }
      id = getIdentifierOrUniqueKeyType( session.getFactory() )
          .replace(id, null, session, owner, copyCache);
      return resolve( id, session, owner );
    }
View Full Code Here

  protected Serializable entityIsPersistent(SaveOrUpdateEvent event) throws HibernateException {
    log.trace( "ignoring persistent instance" );

    EntityEntry entityEntry = event.getEntry();
    if ( entityEntry == null ) {
      throw new AssertionFailure( "entity was transient or detached" );
    }
    else {

      if ( entityEntry.getStatus() == Status.DELETED ) {
        throw new AssertionFailure( "entity was deleted" );
      }

      final SessionFactoryImplementor factory = event.getSession().getFactory();

      Serializable requestedId = event.getRequestedId();
View Full Code Here

    if ( entityEntry != null ) {
      if ( entityEntry.getStatus() == Status.DELETED ) {
        source.forceFlush( entityEntry );
      }
      else {
        throw new AssertionFailure( "entity was persistent" );
      }
    }

    Serializable id = saveWithGeneratedOrRequestedId( event );
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.