Examples of AssertionFailure


Examples of org.hibernate.annotations.common.AssertionFailure

          Object entry = deletes.next();
          // find the matching element
          RowKey assocEntryKey = getTupleKeyForDelete( id, collection, session, entry, deleteByIndex, associationPersister );
          Tuple assocEntryTuple = associationPersister.getAssociation().get( assocEntryKey );
          if ( assocEntryTuple == null ) {
            throw new AssertionFailure( "Deleting a collection tuple that is not present: " + "table {" + getTableName() + "} collectionKey {" + id + "} entry {" + entry + "}" );
          }
          // delete the tuple
          updateInverseSideOfAssociationNavigation( session, entry, assocEntryTuple, Action.REMOVE, assocEntryKey );
          associationPersister.getAssociation().remove( assocEntryKey );
View Full Code Here

Examples of org.hibernate.annotations.common.AssertionFailure

          entityTuple.put( columnName, associationRow.get( columnName ) );
        }
      }
      else if ( action == Action.REMOVE ) {
        if ( hasIdentifier ) {
          throw new AssertionFailure( "A true OneToMany with an identifier for the collection: " + getRole() );
        }
        if ( hasIndex ) {
          // nullify the index
          indexGridType.nullSafeSet( entityTuple, null, getIndexColumnNames(), session );
        }
        keyGridType.nullSafeSet( entityTuple, null, getKeyColumnNames(), session );
      }
      else {
        throw new AssertionFailure( "Unknown action type: " + action );
      }
      gridDialect.insertOrUpdateTuple( entityKey, entityTuple, persister.getTupleContext() ); // update cache
    }
    else if ( associationType == AssociationType.ASSOCIATION_TABLE_TO_ENTITY ) {
      String[] elementColumnNames = getElementColumnNames();
      Object[] elementColumnValues = LogicalPhysicalConverterHelper.getColumnValuesFromResultset( associationRow, elementColumnNames );
      Serializable entityId = (Serializable) gridTypeOfAssociatedId.nullSafeGet( associationRow, getElementColumnNames(), session, null );

      if ( inverseCollectionPersister == null ) {
        return;
      }

      if ( entity == null ) {
        entity = session.getPersistenceContext().getEntity( session.generateEntityKey( entityId, getElementPersister() ) );
      }

      AssociationPersister associationPersister = inverseCollectionPersister.getAssociationPersister( entity, elementColumnValues, session );

      // TODO what happens when a row should be *updated* ?: I suspect ADD works OK as it's a put()
      if ( action == Action.ADD ) {
        RowKey inverseRowKey = getInverseRowKey( associationRow );

        Tuple inverseAssociationRow = new Tuple();
        associationPersister.getAssociation().put( inverseRowKey, inverseAssociationRow );
        for ( String columnName : associationRow.getColumnNames() ) {
          inverseAssociationRow.put( columnName, associationRow.get( columnName ) );
        }
        associationPersister.getAssociation().put( inverseRowKey, inverseAssociationRow );
      }
      else if ( action == Action.REMOVE ) {
        // we try and match the whole tuple as it should be on both sides of the navigation
        if ( rowKey == null ) {
          throw new AssertionFailure( "Deleting a collection tuple that is not present: " + "table {"
              + getTableName() + "} key column names {" + Arrays.toString( elementColumnNames )
              + "} key column values {" + Arrays.toString( elementColumnValues ) + "}" );
        }

        RowKey inverseRowKey = getInverseRowKey( associationRow );
        associationPersister.getAssociation().remove( inverseRowKey );
      }
      else {
        throw new AssertionFailure( "Unknown action type: " + action );
      }

      associationPersister.flushToDatastore();
    }
  }
View Full Code Here

Examples of org.hibernate.annotations.common.AssertionFailure

   */
  public synchronized IndexReader getIndexReader() {
    assertOwnLock();
    // one cannot access a reader for update while a writer is in use
    if ( writer != null )
      throw new AssertionFailure( "Tries to read for update an index while a writer is in use." );
    if ( reader != null )
      return reader;
    Directory directory = directoryProvider.getDirectory();
    try {
      reader = IndexReader.open( directory, false );
View Full Code Here

Examples of org.hibernate.annotations.common.AssertionFailure

      catch ( IOException e ) {
        throw new SearchException( "Exception while closing IndexReader", e );
      }
    }
    else {
      throw new AssertionFailure( "No IndexReader open to close." );
    }
  }
View Full Code Here

Examples of org.hibernate.annotations.common.AssertionFailure

   */
  public synchronized IndexWriter getIndexWriter(boolean batchmode) {
    assertOwnLock();
    // one has to close a reader for update before a writer is accessed
    if ( reader != null )
      throw new AssertionFailure( "Tries to open an IndexWriter while an IndexReader is open in update mode." );
    if ( writer != null )
      return writer;
    try {
      // don't care about the Analyzer as it will be selected during usage of IndexWriter.
      IndexWriter.MaxFieldLength fieldLength = new IndexWriter.MaxFieldLength( IndexWriter.DEFAULT_MAX_FIELD_LENGTH );
View Full Code Here

Examples of org.hibernate.annotations.common.AssertionFailure

      catch ( IOException e ) {
        throw new SearchException( "Exception while commiting index changes", e );
      }
    }
    else {
      throw new AssertionFailure( "No open IndexWriter to commit changes." );
    }
  }
View Full Code Here

Examples of org.hibernate.annotations.common.AssertionFailure

      catch ( IOException e ) {
        throw new SearchException( "Exception while closing IndexWriter", e );
      }
    }
    else {
      throw new AssertionFailure( "No open IndexWriter to close" );
    }
  }
View Full Code Here

Examples of org.hibernate.annotations.common.AssertionFailure

   * @see #lock()
   */
  public synchronized void unlock() {
    try {
      if ( this.reader != null ) {
        throw new AssertionFailure( "Unlocking Workspace without having closed the IndexReader" );
      }
      if ( this.writer != null ) {
        throw new AssertionFailure( "Unlocking Workspace without having closed the IndexWriter" );
      }
    }
    finally {
      lock.unlock();
    }
View Full Code Here

Examples of org.hibernate.annotations.common.AssertionFailure

    }
  }

  private void assertOwnLock() {
    if ( ! lock.isHeldByCurrentThread() )
      throw new AssertionFailure( "Not owning DirectoryProvider Lock" );
  }
View Full Code Here

Examples of org.hibernate.annotations.common.AssertionFailure

      this.entityState = EntityState.NON_INDEXABLE;
    }
  }

  private void init(XClass clazz, InitContext context, ReflectionManager reflectionManager) {
    if ( clazz == null ) throw new AssertionFailure( "Unable to build a DocumentBuilder with a null class" );
    rootPropertiesMetadata.boost = getBoost( clazz );
    rootPropertiesMetadata.analyzer = context.getDefaultAnalyzer();
    Set<XClass> processedClasses = new HashSet<XClass>();
    processedClasses.add( clazz );
    initializeMembers( clazz, rootPropertiesMetadata, true, "", processedClasses, context );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.