HHH-2795 : CollectionLoadContext processing for empty collections

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@13937 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Gail Badner 2007-08-19 23:09:11 +00:00
parent 7955c1a75d
commit d2d2c1c13e
2 changed files with 13 additions and 5 deletions

View File

@ -152,7 +152,7 @@ public class CollectionLoadContext {
public void endLoadingCollections(CollectionPersister persister) {
SessionImplementor session = getLoadContext().getPersistenceContext().getSession();
if ( !loadContexts.hasLoadingCollectionEntries()
|| localLoadingCollectionKeys.isEmpty() ) {
&& localLoadingCollectionKeys.isEmpty() ) {
return;
}

View File

@ -132,6 +132,17 @@ public class LoadContexts {
* false otherwise.
*/
public boolean hasLoadingCollectionEntries() {
return ( collectionLoadContexts != null && !collectionLoadContexts.isEmpty() );
}
/**
* Do we currently have any registered internal entries corresponding to loading
* collections?
*
* @return True if we currently hold state pertaining to a registered loading collections;
* false otherwise.
*/
public boolean hasRegisteredLoadingCollectionEntries() {
return ( xrefLoadingCollectionEntries != null && !xrefLoadingCollectionEntries.isEmpty() );
}
@ -186,9 +197,6 @@ public class LoadContexts {
}
}
// loading collection xrefs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/**
@ -228,7 +236,7 @@ public class LoadContexts {
* @param key The key of the collection we are done processing.
*/
void unregisterLoadingCollectionXRef(CollectionKey key) {
if ( !hasLoadingCollectionEntries() ) {
if ( !hasRegisteredLoadingCollectionEntries() ) {
return;
}
xrefLoadingCollectionEntries.remove(key);