## org.hibernate.engine.loading.internal
Class LoadContexts

    java.lang.Object
      org.hibernate.engine.loading.internal.LoadContexts

    public class LoadContexts

extends Object

Maps `result-sets` to specific contextual data related to processing that result set

Implementation note: internally an `IdentityMap` is used to maintain the mappings mainly because I'd rather not be dependent upon potentially bad `Object.equals(java.lang.Object)` and `Object.hashCode()` implementations on the JDBC result sets

Considering the JDBC-redesign work, would further like this contextual info not mapped separately, but available based on the result set being processed. This would also allow maintaining a single mapping as we could reliably get notification of the result-set closing...

Constructor Summary
`LoadContexts(PersistenceContext persistenceContext)` Creates and binds this to the given persistence context.

Method Summary
`void` `cleanup()` Release internal state associated with *all* result sets.
`void` `cleanup(ResultSet resultSet)` Release internal state associated with the given result set.
`CollectionLoadContext` `getCollectionLoadContext(ResultSet resultSet)` Get the `CollectionLoadContext` associated with the given `ResultSet`, creating one if needed.
`EntityLoadContext` `getEntityLoadContext(ResultSet resultSet)`
`PersistenceContext` `getPersistenceContext()` Retrieves the persistence context to which this is bound.
`boolean` `hasLoadingCollectionEntries()` Do we currently have any internal entries corresponding to loading collections?
`boolean` `hasRegisteredLoadingCollectionEntries()` Do we currently have any registered internal entries corresponding to loading collections?
`PersistentCollection` `locateLoadingCollection(CollectionPersister persister, Serializable ownerKey)` Attempt to locate the loading collection given the owner's key.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### LoadContexts

    public LoadContexts(PersistenceContext persistenceContext)

  Creates and binds this to the given persistence context.

  Parameters:
    `persistenceContext` - The persistence context to which this will be bound.

Method Detail

### getPersistenceContext

    public PersistenceContext getPersistenceContext()

  Retrieves the persistence context to which this is bound.

  Returns:
    The persistence context to which this is bound.

### cleanup

    public void cleanup(ResultSet resultSet)

  Release internal state associated with the given result set.

  This should be called when we are done with processing said result set, ideally as the result set is being closed.

  Parameters:
    `resultSet` - The result set for which it is ok to release associated resources.

### cleanup

    public void cleanup()

  Release internal state associated with *all* result sets.

  This is intended as a "failsafe" process to make sure we get everything cleaned up and released.

### hasLoadingCollectionEntries

    public boolean hasLoadingCollectionEntries()

  Do we currently have any internal entries corresponding to loading collections?

  Returns:
    True if we currently hold state pertaining to loading collections; false otherwise.

### hasRegisteredLoadingCollectionEntries

    public boolean hasRegisteredLoadingCollectionEntries()

  Do we currently have any registered internal entries corresponding to loading collections?

  Returns:
    True if we currently hold state pertaining to a registered loading collections; false otherwise.

### getCollectionLoadContext

    public CollectionLoadContext getCollectionLoadContext(ResultSet resultSet)

  Get the `CollectionLoadContext` associated with the given `ResultSet`, creating one if needed.

  Parameters:
    `resultSet` - The result set for which to retrieve the context.
  Returns:
    The processing context.

### locateLoadingCollection

    public PersistentCollection locateLoadingCollection(CollectionPersister persister,
                                                        Serializable ownerKey)

  Attempt to locate the loading collection given the owner's key. The lookup here occurs against all result-set contexts...

  Parameters:
    `persister` - The collection persister
    `ownerKey` - The owner key
  Returns:
    The loading collection, or null if not found.

### getEntityLoadContext

    public EntityLoadContext getEntityLoadContext(ResultSet resultSet)

Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.