Package org.hibernate.action

Examples of org.hibernate.action.EntityInsertAction


     */
    public void sort() {

      // the list of entity names that indicate the batch number
      for ( Iterator actionItr = insertions.iterator(); actionItr.hasNext(); ) {
        EntityInsertAction action = ( EntityInsertAction ) actionItr.next();
        // remove the current element from insertions. It will be added back later.
        String entityName = action.getEntityName();

        // the entity associated with the current action.
        Object currentEntity = action.getInstance();

        Integer batchNumber;
        if ( latestBatches.containsKey( entityName ) ) {
          // There is already an existing batch for this type of entity.
          // Check to see if the latest batch is acceptable.
          batchNumber = findBatchNumber( action, entityName );
        }
        else {
          // add an entry for this type of entity.
          // we can be assured that all referenced entities have already
          // been processed,
          // so specify that this entity is with the latest batch.
          // doing the batch number before adding the name to the list is
          // a faster way to get an accurate number.

          batchNumber = new Integer( actionBatches.size() );
          latestBatches.put( entityName, batchNumber );
        }
        entityBatchNumber.put( currentEntity, batchNumber );
        addToBatch( batchNumber, action );
      }
      insertions.clear();

      // now rebuild the insertions list. There is a batch for each entry in the name list.
      for ( int i = 0; i < actionBatches.size(); i++ ) {
        List batch = ( List ) actionBatches.get( new Integer( i ) );
        for ( Iterator batchItr = batch.iterator(); batchItr.hasNext(); ) {
          EntityInsertAction action = ( EntityInsertAction ) batchItr.next();
          insertions.add( action );
        }
      }
    }
View Full Code Here


    );
    //source.getPersistenceContext().removeNonExist( new EntityKey( id, persister, source.getEntityMode() ) );

    if ( !useIdentityColumn ) {
      source.getActionQueue().addAction(
          new EntityInsertAction( id, values, entity, version, persister, source )
      );
    }

    cascadeAfterSave( source, persister, entity, anything );
View Full Code Here

     */
    public void sort() {

      // the list of entity names that indicate the batch number
      for ( Iterator actionItr = insertions.iterator(); actionItr.hasNext(); ) {
        EntityInsertAction action = ( EntityInsertAction ) actionItr.next();
        // remove the current element from insertions. It will be added back later.
        String entityName = action.getEntityName();

        // the entity associated with the current action.
        Object currentEntity = action.getInstance();

        Integer batchNumber;
        if ( latestBatches.containsKey( entityName ) ) {
          // There is already an existing batch for this type of entity.
          // Check to see if the latest batch is acceptable.
          batchNumber = findBatchNumber( action, entityName );
        }
        else {
          // add an entry for this type of entity.
          // we can be assured that all referenced entities have already
          // been processed,
          // so specify that this entity is with the latest batch.
          // doing the batch number before adding the name to the list is
          // a faster way to get an accurate number.

          batchNumber = new Integer( actionBatches.size() );
          latestBatches.put( entityName, batchNumber );
        }
        entityBatchNumber.put( currentEntity, batchNumber );
        addToBatch( batchNumber, action );
      }
      insertions.clear();

      // now rebuild the insertions list. There is a batch for each entry in the name list.
      for ( int i = 0; i < actionBatches.size(); i++ ) {
        List batch = ( List ) actionBatches.get( new Integer( i ) );
        for ( Iterator batchItr = batch.iterator(); batchItr.hasNext(); ) {
          EntityInsertAction action = ( EntityInsertAction ) batchItr.next();
          insertions.add( action );
        }
      }
    }
View Full Code Here

      // now rebuild the insertions list. There is a batch for each entry in the name list.
      for ( int i = 0; i < actionBatches.size(); i++ ) {
        List batch = ( List ) actionBatches.get( new Integer( i ) );
        for ( Object aBatch : batch ) {
          EntityInsertAction action = (EntityInsertAction) aBatch;
          insertions.add( action );
        }
      }
    }
View Full Code Here

     */
    public void sort() {

      // the list of entity names that indicate the batch number
      for ( Iterator actionItr = insertions.iterator(); actionItr.hasNext(); ) {
        EntityInsertAction action = ( EntityInsertAction ) actionItr.next();
        // remove the current element from insertions. It will be added back later.
        String entityName = action.getEntityName();

        // the entity associated with the current action.
        Object currentEntity = action.getInstance();

        Integer batchNumber;
        if ( latestBatches.containsKey( entityName ) ) {
          // There is already an existing batch for this type of entity.
          // Check to see if the latest batch is acceptable.
          batchNumber = findBatchNumber( action, entityName );
        }
        else {
          // add an entry for this type of entity.
          // we can be assured that all referenced entities have already
          // been processed,
          // so specify that this entity is with the latest batch.
          // doing the batch number before adding the name to the list is
          // a faster way to get an accurate number.

          batchNumber = new Integer( actionBatches.size() );
          latestBatches.put( entityName, batchNumber );
        }
        entityBatchNumber.put( currentEntity, batchNumber );
        addToBatch( batchNumber, action );
      }
      insertions.clear();

      // now rebuild the insertions list. There is a batch for each entry in the name list.
      for ( int i = 0; i < actionBatches.size(); i++ ) {
        List batch = ( List ) actionBatches.get( new Integer( i ) );
        for ( Iterator batchItr = batch.iterator(); batchItr.hasNext(); ) {
          EntityInsertAction action = ( EntityInsertAction ) batchItr.next();
          insertions.add( action );
        }
      }
    }
View Full Code Here

    );
    //source.getPersistenceContext().removeNonExist( new EntityKey( id, persister, source.getEntityMode() ) );

    if ( !useIdentityColumn ) {
      source.getActionQueue().addAction(
          new EntityInsertAction( id, values, entity, version, persister, source )
      );
    }

    cascadeAfterSave( source, persister, entity, anything );
View Full Code Here

    HashMap positionToAction = new HashMap();
    List nameList = new ArrayList();

    loopInsertion: while( !insertions.isEmpty() ) {
      EntityInsertAction action = ( EntityInsertAction ) insertions.remove( 0 );
      String thisEntityName = action.getEntityName();

      // see if we have already encountered this entity-name...
      if ( ! nameList.contains( thisEntityName ) ) {
        // we have not, so create the proper entries in nameList and positionToAction
        ArrayList segmentedActionQueue = new ArrayList();
        segmentedActionQueue.add( action );
        nameList.add( thisEntityName );
        positionToAction.put( new Integer( nameList.indexOf( thisEntityName ) ), segmentedActionQueue );
      }
      else {
        // we have seen it before, so we need to determine if this insert action is
        // is depenedent upon a previously processed action in terms of FK
        // relationships (this FK checking is done against the entity's property-state
        // associated with the action...)
        int lastPos = nameList.lastIndexOf( thisEntityName );
        Object[] states = action.getState();
        for ( int i = 0; i < states.length; i++ ) {
          for ( int j = 0; j < nameList.size(); j++ ) {
            ArrayList tmpList = ( ArrayList ) positionToAction.get( new Integer( j ) );
            for ( int k = 0; k < tmpList.size(); k++ ) {
              final EntityInsertAction checkAction = ( EntityInsertAction ) tmpList.get( k );
              if ( checkAction.getInstance() == states[i] && j > lastPos ) {
                // 'checkAction' is inserting an entity upon which 'action'
                // depends...
                // note: this is an assumption and may not be correct in the case of one-to-one
                ArrayList segmentedActionQueue = new ArrayList();
                segmentedActionQueue.add( action );
View Full Code Here

    );
    //source.getPersistenceContext().removeNonExist( new EntityKey( id, persister, source.getEntityMode() ) );

    if ( !useIdentityColumn ) {
      source.getActionQueue().addAction(
          new EntityInsertAction( id, values, entity, version, persister, source )
      );
    }

    cascadeAfterSave( source, persister, entity, anything );
View Full Code Here

    );
    //source.getPersistenceContext().removeNonExist( new EntityKey( id, persister, source.getEntityMode() ) );

    if ( !useIdentityColumn ) {
      source.getActionQueue().addAction(
          new EntityInsertAction( id, values, entity, version, persister, source )
      );
    }

    cascadeAfterSave( source, persister, entity, anything );
View Full Code Here

     */
    public void sort() {

      // the list of entity names that indicate the batch number
      for ( Iterator actionItr = insertions.iterator(); actionItr.hasNext(); ) {
        EntityInsertAction action = ( EntityInsertAction ) actionItr.next();
        // remove the current element from insertions. It will be added back later.
        String entityName = action.getEntityName();

        // the entity associated with the current action.
        Object currentEntity = action.getInstance();

        Integer batchNumber;
        if ( latestBatches.containsKey( entityName ) ) {
          // There is already an existing batch for this type of entity.
          // Check to see if the latest batch is acceptable.
          batchNumber = findBatchNumber( action, entityName );
        }
        else {
          // add an entry for this type of entity.
          // we can be assured that all referenced entities have already
          // been processed,
          // so specify that this entity is with the latest batch.
          // doing the batch number before adding the name to the list is
          // a faster way to get an accurate number.

          batchNumber = new Integer( actionBatches.size() );
          latestBatches.put( entityName, batchNumber );
        }
        entityBatchNumber.put( currentEntity, batchNumber );
        addToBatch( batchNumber, action );
      }
      insertions.clear();

      // now rebuild the insertions list. There is a batch for each entry in the name list.
      for ( int i = 0; i < actionBatches.size(); i++ ) {
        List batch = ( List ) actionBatches.get( new Integer( i ) );
        for ( Iterator batchItr = batch.iterator(); batchItr.hasNext(); ) {
          EntityInsertAction action = ( EntityInsertAction ) batchItr.next();
          insertions.add( action );
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.hibernate.action.EntityInsertAction

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.