Package org.hibernate.engine

Examples of org.hibernate.engine.ActionQueue


        LOG.trace("Scheduling collection removes/(re)creates/updates");

    list = IdentityMap.entries( session.getPersistenceContext().getCollectionEntries() );
    size = list.size();
    ActionQueue actionQueue = session.getActionQueue();
    for ( int i = 0; i < size; i++ ) {
      Map.Entry me = (Map.Entry) list.get(i);
      PersistentCollection coll = (PersistentCollection) me.getKey();
      CollectionEntry ce = (CollectionEntry) me.getValue();

      if ( ce.isDorecreate() ) {
        session.getInterceptor().onCollectionRecreate( coll, ce.getCurrentKey() );
        actionQueue.addAction(
            new CollectionRecreateAction(
                coll,
                ce.getCurrentPersister(),
                ce.getCurrentKey(),
                session
              )
          );
      }
      if ( ce.isDoremove() ) {
        session.getInterceptor().onCollectionRemove( coll, ce.getLoadedKey() );
        actionQueue.addAction(
            new CollectionRemoveAction(
                coll,
                ce.getLoadedPersister(),
                ce.getLoadedKey(),
                ce.isSnapshotEmpty(coll),
                session
              )
          );
      }
      if ( ce.isDoupdate() ) {
        session.getInterceptor().onCollectionUpdate( coll, ce.getLoadedKey() );
        actionQueue.addAction(
            new CollectionUpdateAction(
                coll,
                ce.getLoadedPersister(),
                ce.getLoadedKey(),
                ce.isSnapshotEmpty(coll),
                session
              )
          );
      }

    }

    actionQueue.sortCollectionActions();

  }
View Full Code Here


             * would be eaten).
             *
             * In a JTA env, the before transaction completion is called before the flush, so not all changes are yet
             * written. However, Synchronization-s do propagate exceptions, so they can be safely used.
             */
      final ActionQueue actionQueue = eventSource.getActionQueue();
      boolean isLocal = isLocalTransaction();
      if ( isLocal ) {
        //if local tx never use Synchronization
        actionQueue.registerProcess( new DelegateToSynchronizationOnBeforeTx( synchronization ) );
      }
      else {
        //TODO could we remove the action queue registration in this case?
        actionQueue.registerProcess( new DelegateToSynchronizationOnBeforeTx( synchronization ) );
        eventSource.getTransaction().registerSynchronization(
            new BeforeCommitSynchronizationDelegator( synchronization )
        );
      }

      //executed in all environments
      actionQueue.registerProcess( new DelegateToSynchronizationOnAfterTx( synchronization ) );
    }
    else {
      //registerSynchronization is only called if isRealTransactionInProgress or if
      // a flushListener was found; still we might need to find the listener again
      // as it might have been cleared by serialization (is transient).
View Full Code Here

    this.rootSession = parent;
    this.timestamp = parent.timestamp;
    this.jdbcContext = parent.jdbcContext;
    this.interceptor = parent.interceptor;
    this.listeners = parent.listeners;
    this.actionQueue = new ActionQueue( this );
    this.entityMode = entityMode;
    this.persistenceContext = new StatefulPersistenceContext( this );
    this.flushBeforeCompletionEnabled = false;
    this.autoCloseSessionEnabled = false;
    this.connectionReleaseMode = null;
View Full Code Here

    this.rootSession = null;
    this.timestamp = timestamp;
    this.entityMode = entityMode;
    this.interceptor = interceptor;
    this.listeners = factory.getEventListeners();
    this.actionQueue = new ActionQueue( this );
    this.persistenceContext = new StatefulPersistenceContext( this );
    this.flushBeforeCompletionEnabled = flushBeforeCompletionEnabled;
    this.autoCloseSessionEnabled = autoCloseSessionEnabled;
    this.connectionReleaseMode = connectionReleaseMode;
    this.jdbcContext = new JDBCContext( this, connection, interceptor );
View Full Code Here

    this.rootSession = parent;
    this.timestamp = parent.timestamp;
    this.jdbcContext = parent.jdbcContext;
    this.interceptor = parent.interceptor;
    this.listeners = parent.listeners;
    this.actionQueue = new ActionQueue( this );
    this.entityMode = entityMode;
    this.persistenceContext = new StatefulPersistenceContext( this );
    this.flushBeforeCompletionEnabled = false;
    this.autoCloseSessionEnabled = false;
    this.connectionReleaseMode = null;
View Full Code Here

    this.rootSession = null;
    this.timestamp = timestamp;
    this.entityMode = entityMode;
    this.interceptor = interceptor;
    this.listeners = factory.getEventListeners();
    this.actionQueue = new ActionQueue( this );
    this.persistenceContext = new StatefulPersistenceContext( this );
    this.flushBeforeCompletionEnabled = flushBeforeCompletionEnabled;
    this.autoCloseSessionEnabled = autoCloseSessionEnabled;
    this.connectionReleaseMode = connectionReleaseMode;
    this.jdbcContext = new JDBCContext( this, connection, interceptor );
View Full Code Here

        LOG.trace("Scheduling collection removes/(re)creates/updates");

    list = IdentityMap.entries( session.getPersistenceContext().getCollectionEntries() );
    size = list.size();
    ActionQueue actionQueue = session.getActionQueue();
    for ( int i = 0; i < size; i++ ) {
      Map.Entry me = (Map.Entry) list.get(i);
      PersistentCollection coll = (PersistentCollection) me.getKey();
      CollectionEntry ce = (CollectionEntry) me.getValue();

      if ( ce.isDorecreate() ) {
        session.getInterceptor().onCollectionRecreate( coll, ce.getCurrentKey() );
        actionQueue.addAction(
            new CollectionRecreateAction(
                coll,
                ce.getCurrentPersister(),
                ce.getCurrentKey(),
                session
              )
          );
      }
      if ( ce.isDoremove() ) {
        session.getInterceptor().onCollectionRemove( coll, ce.getLoadedKey() );
        actionQueue.addAction(
            new CollectionRemoveAction(
                coll,
                ce.getLoadedPersister(),
                ce.getLoadedKey(),
                ce.isSnapshotEmpty(coll),
                session
              )
          );
      }
      if ( ce.isDoupdate() ) {
        session.getInterceptor().onCollectionUpdate( coll, ce.getLoadedKey() );
        actionQueue.addAction(
            new CollectionUpdateAction(
                coll,
                ce.getLoadedPersister(),
                ce.getLoadedKey(),
                ce.isSnapshotEmpty(coll),
                session
              )
          );
      }

    }

    actionQueue.sortCollectionActions();

  }
View Full Code Here

  public void registerSynchronization(Synchronization synchronization) {
    if ( isRealTransactionInProgress() ) {
      //use {Before|After}TransactionCompletionProcess instead of registerTransaction because it does not
      //swallow transactions.
      final ActionQueue actionQueue = eventSource.getActionQueue();
      actionQueue.registerProcess( new DelegateToSynchronizationOnBeforeTx( synchronization ) );
      actionQueue.registerProcess( new DelegateToSynchronizationOnAfterTx( synchronization ) );
//      eventSource.getTransaction().registerSynchronization( synchronization );
    }
    else {
      //registerSynchronization is only called if isRealTransactionInProgress or if
      // a flushListener was found; still we might need to find the listener again
View Full Code Here

             *
             * In a JTA env, the before transaction completion is called before the flush, so not all changes are yet
             * written. However, Synchronization-s do propagate exceptions, so they can be safely used.
             */

      final ActionQueue actionQueue = eventSource.getActionQueue();
      actionQueue.registerProcess( new DelegateToSynchronizationOnBeforeTx( synchronization ) );
      eventSource.getTransaction().registerSynchronization(
          new BeforeCommitSynchronizationDelegator( synchronization )
      );

      //executed in all environments
      actionQueue.registerProcess( new DelegateToSynchronizationOnAfterTx( synchronization ) );
    }
    else {
      //registerSynchronization is only called if isRealTransactionInProgress or if
      // a flushListener was found; still we might need to find the listener again
      // as it might have been cleared by serialization (is transient).
View Full Code Here

    log.trace( "Scheduling collection removes/(re)creates/updates" );

    list = IdentityMap.entries( session.getPersistenceContext().getCollectionEntries() );
    size = list.size();
    ActionQueue actionQueue = session.getActionQueue();
    for ( int i = 0; i < size; i++ ) {
      Map.Entry me = (Map.Entry) list.get(i);
      PersistentCollection coll = (PersistentCollection) me.getKey();
      CollectionEntry ce = (CollectionEntry) me.getValue();

      if ( ce.isDorecreate() ) {
        session.getInterceptor().onCollectionRecreate( coll, ce.getCurrentKey() );
        actionQueue.addAction(
            new CollectionRecreateAction(
                coll,
                ce.getCurrentPersister(),
                ce.getCurrentKey(),
                session
              )
          );
      }
      if ( ce.isDoremove() ) {
        session.getInterceptor().onCollectionRemove( coll, ce.getLoadedKey() );
        actionQueue.addAction(
            new CollectionRemoveAction(
                coll,
                ce.getLoadedPersister(),
                ce.getLoadedKey(),
                ce.isSnapshotEmpty(coll),
                session
              )
          );
      }
      if ( ce.isDoupdate() ) {
        session.getInterceptor().onCollectionUpdate( coll, ce.getLoadedKey() );
        actionQueue.addAction(
            new CollectionUpdateAction(
                coll,
                ce.getLoadedPersister(),
                ce.getLoadedKey(),
                ce.isSnapshotEmpty(coll),
                session
              )
          );
      }

    }

    actionQueue.sortCollectionActions();
   
  }
View Full Code Here

TOP

Related Classes of org.hibernate.engine.ActionQueue

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.