|
From: Denis B. (JIRA) <nh...@gm...> - 2010-10-06 05:19:43
|
Patch for StatefulPersistenceContext for non-lazy collections (HHH-2862)
------------------------------------------------------------------------
Key: NH-2366
URL: http://216.121.112.228/browse/NH-2366
Project: NHibernate
Issue Type: Patch
Components: Core
Affects Versions: 2.1.2.GA
Reporter: Denis Bykov
Priority: Major
Attachments: nh_2.1.2_StatefulPersistenceContext.patch
This patch fix problem, similar to described in HHH-2862 ("Collection is not associated with any session exception when doing an eager fetch on a non-unique collection." http://opensource.atlassian.com/projects/hibernate/browse/HHH-2862)
-----------------------------------------------------
Copied description from HHH-2682:
It is basically caused by having an eager collection where the key of the collection is not unique in the results.
The code works as follows in CollectionType.getCollection():
....
persistenceContext.addUninitializedCollection( persister, collection, key );
// some collections are not lazy:
if ( initializeImmediately( entityMode ) ) { session.initializeCollection( collection, false ); }
else if ( !persister.isLazy() ) { persistenceContext.addNonLazyCollection( collection ); }
if ( hasHolder( entityMode ) ) { session.getPersistenceContext().addCollectionHolder( collection ); }
if persistenceContext.addUninitializedCollection() detects that the collection with the given key has already been added it clears the session on the old instance of the collection (sets it to null). However, that collection has already been added to the persistence context by an earlier call to this method. So later when StatefulPersistenceContext.initializeNonLazyCollections() is called it iterates through all of the collections in the persistence context (including those which have had their session set to null by addUninitializedCollection()), calling forceInitialization() which throws a 'collection is not associated with any session' exception.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
|
|
From: Fabio M. (JIRA) <nh...@gm...> - 2010-10-06 16:30:50
|
[ http://216.121.112.228/browse/NH-2366?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=19973#action_19973 ]
Fabio Maulo commented on NH-2366:
---------------------------------
I can't find the failing test in your patch. Am I missing something ?
> Patch for StatefulPersistenceContext for non-lazy collections (HHH-2862)
> ------------------------------------------------------------------------
>
> Key: NH-2366
> URL: http://216.121.112.228/browse/NH-2366
> Project: NHibernate
> Issue Type: Patch
> Components: Core
> Affects Versions: 2.1.2.GA
> Reporter: Denis Bykov
> Priority: Major
> Attachments: nh_2.1.2_StatefulPersistenceContext.patch
>
>
> This patch fix problem, similar to described in HHH-2862 ("Collection is not associated with any session exception when doing an eager fetch on a non-unique collection." http://opensource.atlassian.com/projects/hibernate/browse/HHH-2862)
> -----------------------------------------------------
> Copied description from HHH-2682:
> It is basically caused by having an eager collection where the key of the collection is not unique in the results.
> The code works as follows in CollectionType.getCollection():
> ....
> persistenceContext.addUninitializedCollection( persister, collection, key );
> // some collections are not lazy:
> if ( initializeImmediately( entityMode ) ) { session.initializeCollection( collection, false ); }
> else if ( !persister.isLazy() ) { persistenceContext.addNonLazyCollection( collection ); }
> if ( hasHolder( entityMode ) ) { session.getPersistenceContext().addCollectionHolder( collection ); }
> if persistenceContext.addUninitializedCollection() detects that the collection with the given key has already been added it clears the session on the old instance of the collection (sets it to null). However, that collection has already been added to the persistence context by an earlier call to this method. So later when StatefulPersistenceContext.initializeNonLazyCollections() is called it iterates through all of the collections in the persistence context (including those which have had their session set to null by addUninitializedCollection()), calling forceInitialization() which throws a 'collection is not associated with any session' exception.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
|
|
From: Julian M. (JIRA) <nh...@gm...> - 2011-02-06 01:21:14
|
[ http://216.121.112.228/browse/NH-2366?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Julian Maughan updated NH-2366:
-------------------------------
Attachment: NH-2366.test.patch
I've attached a failing test, but unfortunately the patch (nh_2.1.2_StatefulPersistenceContext.patch) does not make it pass.
> Patch for StatefulPersistenceContext for non-lazy collections (HHH-2862)
> ------------------------------------------------------------------------
>
> Key: NH-2366
> URL: http://216.121.112.228/browse/NH-2366
> Project: NHibernate
> Issue Type: Patch
> Components: Core
> Affects Versions: 2.1.2.GA
> Reporter: Denis Bykov
> Priority: Major
> Attachments: NH-2366.test.patch, nh_2.1.2_StatefulPersistenceContext.patch
>
>
> This patch fix problem, similar to described in HHH-2862 ("Collection is not associated with any session exception when doing an eager fetch on a non-unique collection." http://opensource.atlassian.com/projects/hibernate/browse/HHH-2862)
> -----------------------------------------------------
> Copied description from HHH-2682:
> It is basically caused by having an eager collection where the key of the collection is not unique in the results.
> The code works as follows in CollectionType.getCollection():
> ....
> persistenceContext.addUninitializedCollection( persister, collection, key );
> // some collections are not lazy:
> if ( initializeImmediately( entityMode ) ) { session.initializeCollection( collection, false ); }
> else if ( !persister.isLazy() ) { persistenceContext.addNonLazyCollection( collection ); }
> if ( hasHolder( entityMode ) ) { session.getPersistenceContext().addCollectionHolder( collection ); }
> if persistenceContext.addUninitializedCollection() detects that the collection with the given key has already been added it clears the session on the old instance of the collection (sets it to null). However, that collection has already been added to the persistence context by an earlier call to this method. So later when StatefulPersistenceContext.initializeNonLazyCollections() is called it iterates through all of the collections in the persistence context (including those which have had their session set to null by addUninitializedCollection()), calling forceInitialization() which throws a 'collection is not associated with any session' exception.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
|
|
From: Fabio M. (JIRA) <nh...@gm...> - 2011-05-20 16:48:07
|
[ http://216.121.112.228/browse/NH-2366?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21137#action_21137 ]
Fabio Maulo commented on NH-2366:
---------------------------------
Test committed in the trunk.
> Patch for StatefulPersistenceContext for non-lazy collections (HHH-2862)
> ------------------------------------------------------------------------
>
> Key: NH-2366
> URL: http://216.121.112.228/browse/NH-2366
> Project: NHibernate
> Issue Type: Patch
> Components: Core
> Affects Versions: 2.1.2.GA
> Reporter: Denis Bykov
> Priority: Major
> Attachments: NH-2366.test.patch, nh_2.1.2_StatefulPersistenceContext.patch
>
>
> This patch fix problem, similar to described in HHH-2862 ("Collection is not associated with any session exception when doing an eager fetch on a non-unique collection." http://opensource.atlassian.com/projects/hibernate/browse/HHH-2862)
> -----------------------------------------------------
> Copied description from HHH-2682:
> It is basically caused by having an eager collection where the key of the collection is not unique in the results.
> The code works as follows in CollectionType.getCollection():
> ....
> persistenceContext.addUninitializedCollection( persister, collection, key );
> // some collections are not lazy:
> if ( initializeImmediately( entityMode ) ) { session.initializeCollection( collection, false ); }
> else if ( !persister.isLazy() ) { persistenceContext.addNonLazyCollection( collection ); }
> if ( hasHolder( entityMode ) ) { session.getPersistenceContext().addCollectionHolder( collection ); }
> if persistenceContext.addUninitializedCollection() detects that the collection with the given key has already been added it clears the session on the old instance of the collection (sets it to null). However, that collection has already been added to the persistence context by an earlier call to this method. So later when StatefulPersistenceContext.initializeNonLazyCollections() is called it iterates through all of the collections in the persistence context (including those which have had their session set to null by addUninitializedCollection()), calling forceInitialization() which throws a 'collection is not associated with any session' exception.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
|