Package org.hibernate.engine

Examples of org.hibernate.engine.CollectionKey


    PersistentCollection collection = persistenceContext.getLoadContexts().locateLoadingCollection( persister, key );
   
    if ( collection == null ) {
     
      // check if it is already completely loaded, but unowned
      collection = persistenceContext.useUnownedCollection( new CollectionKey(persister, key, entityMode) );
     
      if ( collection == null ) {
        // create a new collection wrapper, to be initialized later
        collection = instantiate( session, persister, key );
        collection.setOwner(owner);
View Full Code Here


        persistenceContext.getCollectionEntries()
            .remove(persistentCollection);
      }
      else {
        //otherwise recreate the mapping between the collection and its key
        CollectionKey collectionKey = new CollectionKey(
            collectionEntry.getLoadedPersister(),
            collectionEntry.getLoadedKey(),
            session.getEntityMode()
          );
        persistenceContext.getCollectionsByKey()
View Full Code Here

   *
   * @return The loading collection (see discussion above).
   */
  public PersistentCollection getLoadingCollection(final CollectionPersister persister, final Serializable key) {
    final EntityMode em = loadContexts.getPersistenceContext().getSession().getEntityMode();
    final CollectionKey collectionKey = new CollectionKey( persister, key, em );
    if ( log.isTraceEnabled() ) {
      log.trace( "starting attempt to find loading collection [" + MessageHelper.collectionInfoString( persister.getRole(), key ) + "]" );
    }
    final LoadingCollectionEntry loadingCollectionEntry = loadContexts.locateLoadingCollectionEntry( collectionKey );
    if ( loadingCollectionEntry == null ) {
View Full Code Here

    // in a temp collection.  the temp collection is then used to "drive"
    // the #endRead processing.
    List matches = null;
    Iterator iter = localLoadingCollectionKeys.iterator();
    while ( iter.hasNext() ) {
      final CollectionKey collectionKey = (CollectionKey) iter.next();
      final LoadingCollectionEntry lce = loadContexts.locateLoadingCollectionEntry( collectionKey );
      if ( lce == null) {
        log.warn( "In CollectionLoadContext#endLoadingCollections, localLoadingCollectionKeys contained [" + collectionKey + "], but no LoadingCollectionEntry was found in loadContexts" );
      }
      else if ( lce.getResultSet() == resultSet && lce.getPersister() == persister ) {
        if ( matches == null ) {
          matches = new ArrayList();
        }
        matches.add( lce );
        if ( lce.getCollection().getOwner() == null ) {
          session.getPersistenceContext().addUnownedCollection(
              new CollectionKey( persister, lce.getKey(), session.getEntityMode() ),
              lce.getCollection()
          );
        }
        if ( log.isTraceEnabled() ) {
          log.trace( "removing collection load entry [" + lce + "]" );
View Full Code Here

                                                                                ce.getLoadedKey(),
                                                                                getSession().getFactory()));
    if ( ce.getLoadedPersister() != null && ce.getLoadedKey() != null ) {
      //TODO: is this 100% correct?
      getSession().getPersistenceContext().getCollectionsByKey().remove(
          new CollectionKey( ce.getLoadedPersister(), ce.getLoadedKey(), getSession().getEntityMode() )
      );
    }
  }
View Full Code Here

    PersistentCollection collection = persistenceContext.getLoadContexts().locateLoadingCollection( persister, key );
   
    if ( collection == null ) {
     
      // check if it is already completely loaded, but unowned
      collection = persistenceContext.useUnownedCollection( new CollectionKey(persister, key, entityMode) );
     
      if ( collection == null ) {
        // create a new collection wrapper, to be initialized later
        collection = instantiate( session, persister, key );
        collection.setOwner(owner);
View Full Code Here

        persistenceContext.getCollectionEntries()
            .remove(persistentCollection);
      }
      else {
        //otherwise recreate the mapping between the collection and its key
        CollectionKey collectionKey = new CollectionKey(
            collectionEntry.getLoadedPersister(),
            collectionEntry.getLoadedKey(),
            session.getEntityMode()
          );
        persistenceContext.getCollectionsByKey()
View Full Code Here

    PersistentCollection collection = persistenceContext.getLoadContexts().locateLoadingCollection( persister, key );
   
    if ( collection == null ) {
     
      // check if it is already completely loaded, but unowned
      collection = persistenceContext.useUnownedCollection( new CollectionKey(persister, key, entityMode) );
     
      if ( collection == null ) {
        // create a new collection wrapper, to be initialized later
        collection = instantiate( session, persister, key );
        collection.setOwner(owner);
View Full Code Here

   *
   * @return The loading collection (see discussion above).
   */
  public PersistentCollection getLoadingCollection(final CollectionPersister persister, final Serializable key) {
    final EntityMode em = loadContexts.getPersistenceContext().getSession().getEntityMode();
    final CollectionKey collectionKey = new CollectionKey( persister, key, em );
        if (LOG.isTraceEnabled()) LOG.trace("Starting attempt to find loading collection ["
                                            + MessageHelper.collectionInfoString(persister.getRole(), key) + "]");
    final LoadingCollectionEntry loadingCollectionEntry = loadContexts.locateLoadingCollectionEntry( collectionKey );
    if ( loadingCollectionEntry == null ) {
      // look for existing collection as part of the persistence context
View Full Code Here

    // in a temp collection.  the temp collection is then used to "drive"
    // the #endRead processing.
    List matches = null;
    Iterator iter = localLoadingCollectionKeys.iterator();
    while ( iter.hasNext() ) {
      final CollectionKey collectionKey = (CollectionKey) iter.next();
      final LoadingCollectionEntry lce = loadContexts.locateLoadingCollectionEntry( collectionKey );
            if (lce == null) LOG.loadingCollectionKeyNotFound(collectionKey);
      else if ( lce.getResultSet() == resultSet && lce.getPersister() == persister ) {
        if ( matches == null ) {
          matches = new ArrayList();
        }
        matches.add( lce );
        if ( lce.getCollection().getOwner() == null ) {
          session.getPersistenceContext().addUnownedCollection(
              new CollectionKey( persister, lce.getKey(), session.getEntityMode() ),
              lce.getCollection()
          );
        }
                LOG.trace("Removing collection load entry [" + lce + "]");
View Full Code Here

TOP

Related Classes of org.hibernate.engine.CollectionKey

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.