Package org.hibernate.engine.spi

Examples of org.hibernate.engine.spi.CollectionKey


   *
   * @return The loading collection (see discussion above).
   */
  public PersistentCollection getLoadingCollection(final CollectionPersister persister, final Serializable key) {
    final EntityMode em = persister.getOwnerEntityPersister().getEntityMetamodel().getEntityMode();
    final CollectionKey collectionKey = new CollectionKey( persister, key, em );
    if ( LOG.isTraceEnabled() ) {
      LOG.tracev( "Starting attempt to find loading collection [{0}]",
          MessageHelper.collectionInfoString( persister.getRole(), key ) );
    }
    final LoadingCollectionEntry loadingCollectionEntry = loadContexts.locateLoadingCollectionEntry( collectionKey );
View Full Code Here


    // in a temp collection.  the temp collection is then used to "drive"
    // the #endRead processing.
    List<LoadingCollectionEntry> matches = null;
    final Iterator itr = localLoadingCollectionKeys.iterator();
    while ( itr.hasNext() ) {
      final CollectionKey collectionKey = (CollectionKey) itr.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<LoadingCollectionEntry>();
        }
        matches.add( lce );
        if ( lce.getCollection().getOwner() == null ) {
          session.getPersistenceContext().addUnownedCollection(
              new CollectionKey(
                  persister,
                  lce.getKey(),
                  persister.getOwnerEntityPersister().getEntityMetamodel().getEntityMode()
              ),
              lce.getCollection()
View Full Code Here

   * @param persister The collection persister
   * @param ownerKey The owner key
   * @return The loading collection, or null if not found.
   */
  public PersistentCollection locateLoadingCollection(CollectionPersister persister, Serializable ownerKey) {
    final LoadingCollectionEntry lce = locateLoadingCollectionEntry( new CollectionKey( persister, ownerKey ) );
    if ( lce != null ) {
      if ( LOG.isTraceEnabled() ) {
        LOG.tracef(
            "Returning loading collection: %s",
            MessageHelper.collectionInfoString( persister, ownerKey, getSession().getFactory() )
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 );
       
View Full Code Here

   * @param entry The entry representing the collection.
   * @param key The key of the collection's entry.
   */
  private void addCollection(PersistentCollection coll, CollectionEntry entry, Serializable key) {
    collectionEntries.put( coll, entry );
    final CollectionKey collectionKey = new CollectionKey( entry.getLoadedPersister(), key );
    final PersistentCollection old = collectionsByKey.put( collectionKey, coll );
    if ( old != null ) {
      if ( old == coll ) {
        throw new AssertionFailure( "bug adding collection twice" );
      }
View Full Code Here

      getSession().getPersistenceContext().getBatchFetchQueue().removeBatchLoadableCollection(ce);
    }
    if ( ce.getLoadedPersister() != null && ce.getLoadedKey() != null ) {
      //TODO: is this 100% correct?
      getSession().getPersistenceContext().getCollectionsByKey().remove(
          new CollectionKey( ce.getLoadedPersister(), ce.getLoadedKey() )
      );
    }
  }
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()
        );
        persistenceContext.getCollectionsByKey().put(collectionKey, persistentCollection);
      }
View Full Code Here

   *
   * @return The loading collection (see discussion above).
   */
  public PersistentCollection getLoadingCollection(final CollectionPersister persister, final Serializable key) {
    final EntityMode em = persister.getOwnerEntityPersister().getEntityMetamodel().getEntityMode();
    final CollectionKey collectionKey = new CollectionKey( persister, key, em );
    if ( LOG.isTraceEnabled() ) {
      LOG.tracev( "Starting attempt to find loading collection [{0}]",
          MessageHelper.collectionInfoString( persister.getRole(), key ) );
    }
    final LoadingCollectionEntry loadingCollectionEntry = loadContexts.locateLoadingCollectionEntry( collectionKey );
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(),
                  persister.getOwnerEntityPersister().getEntityMetamodel().getEntityMode()
              ),
              lce.getCollection()
View Full Code Here

   * @param persister The collection persister
   * @param ownerKey The owner key
   * @return The loading collection, or null if not found.
   */
  public PersistentCollection locateLoadingCollection(CollectionPersister persister, Serializable ownerKey) {
    LoadingCollectionEntry lce = locateLoadingCollectionEntry( new CollectionKey( persister, ownerKey ) );
    if ( lce != null ) {
      if ( LOG.isTraceEnabled() ) {
        LOG.tracef(
            "Returning loading collection: %s",
            MessageHelper.collectionInfoString( persister, ownerKey, getSession().getFactory() )
View Full Code Here

TOP

Related Classes of org.hibernate.engine.spi.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.