Top Description Fields Constructors Methods
org.hibernate.engine.loading

public Class CollectionLoadContext

extends Object
Class Inheritance
Imports
org.hibernate.CacheMode, .EntityMode, .HibernateException, org.hibernate.cache.CacheKey, org.hibernate.cache.entry.CollectionCacheEntry, org.hibernate.collection.PersistentCollection, org.hibernate.engine.*, org.hibernate.persister.collection.CollectionPersister, org.hibernate.pretty.MessageHelper, org.slf4j.Logger, .LoggerFactory, java.io.Serializable, java.sql.ResultSet, java.util.*

Represents state associated with the processing of a given ResultSet in regards to loading collections.

Another implementation option to consider is to not expose ResultSets directly (in the JDBC redesign) but to always "wrap" them and apply a [series of] context[s] to that wrapper.

Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
private final LoadContexts
private Set<E>
private static final Logger
private final ResultSet

Constructor Summary

AccessConstructor and Description
public
CollectionLoadContext(LoadContexts
Callback to other collection load contexts.
loadContexts
,
ResultSet
The result set this is "wrapping".
resultSet
)

Creates a collection load context for the given result set.

Method Summary

Modifier and TypeMethod and Description
private void
addCollectionToCache(LoadingCollectionEntry
The entry representing the collection to add
lce
,
CollectionPersister
The persister
persister
)

Add the collection to the second-level cache

pack-priv void
private void
public void
endLoadingCollections(CollectionPersister
The persister for which to complete loading.
persister
)

Finish the process of collection-loading for this bound result set.

private void
endLoadingCollections(CollectionPersister persister, List<E> matchedCollectionEntries)

public LoadContexts
public PersistentCollection

Returns:

The loading collection (see discussion above).
getLoadingCollection
(final CollectionPersister
The persister for the collection being requested.
persister
,
final Serializable
The key of the collection being requested.
key
)

Retrieve the collection that is being loaded as part of processing this result set.

public ResultSet
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

loadContextsback to summary
private final LoadContexts loadContexts
localLoadingCollectionKeysback to summary
private Set<E> localLoadingCollectionKeys
logback to summary
private static final Logger log
resultSetback to summary
private final ResultSet resultSet

Constructor Detail

CollectionLoadContextback to summary
public CollectionLoadContext(LoadContexts loadContexts, ResultSet resultSet)

Creates a collection load context for the given result set.

Parameters
loadContexts:LoadContexts

Callback to other collection load contexts.

resultSet:ResultSet

The result set this is "wrapping".

Method Detail

addCollectionToCacheback to summary
private void addCollectionToCache(LoadingCollectionEntry lce, CollectionPersister persister)

Add the collection to the second-level cache

Parameters
lce:LoadingCollectionEntry

The entry representing the collection to add

persister:CollectionPersister

The persister

cleanupback to summary
pack-priv void cleanup()
endLoadingCollectionback to summary
private void endLoadingCollection(LoadingCollectionEntry lce, CollectionPersister persister)
endLoadingCollectionsback to summary
public void endLoadingCollections(CollectionPersister persister)

Finish the process of collection-loading for this bound result set. Mainly this involves cleaning up resources and notifying the collections that loading is complete.

Parameters
persister:CollectionPersister

The persister for which to complete loading.

endLoadingCollectionsback to summary
private void endLoadingCollections(CollectionPersister persister, List<E> matchedCollectionEntries)
getLoadContextback to summary
public LoadContexts getLoadContext()
getLoadingCollectionback to summary
public PersistentCollection getLoadingCollection(final CollectionPersister persister, final Serializable key)

Retrieve the collection that is being loaded as part of processing this result set.

Basically, there are two valid return values from this method:

  • an instance of PersistentCollection which indicates to continue loading the result set row data into that returned collection instance; this may be either an instance already associated and in the midst of being loaded, or a newly instantiated instance as a matching associated collection was not found.
  • null indicates to ignore the corresponding result set row data relating to the requested collection; this indicates that either the collection was found to already be associated with the persistence context in a fully loaded state, or it was found in a loading state associated with another result set processing context.
Parameters
persister:CollectionPersister

The persister for the collection being requested.

key:Serializable

The key of the collection being requested.

Returns:PersistentCollection

The loading collection (see discussion above).

getResultSetback to summary
public ResultSet getResultSet()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.