[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3129) Null Role in PersitentCollection during a onCollectionRecreate() in an Interceptor

Gail Badner (JIRA) noreply at atlassian.com
Mon Feb 25 18:10:33 EST 2008


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3129?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_29577 ] 

Gail Badner commented on HHH-3129:
----------------------------------

This is not as simple a fix as it seems.

This constructor is used in other cases than when a collection is recreated. It may not be appropriate for the role to always be set in this constructor. In particular, if the collection is being dereferenced, then the role should remain null.

Also, this patch breaks a unit test: org.hibernate.test.legacy.FumTest.testUnflushedSessionSerialization() .

> Null Role in PersitentCollection during a onCollectionRecreate() in an Interceptor
> ----------------------------------------------------------------------------------
>
>                 Key: HHH-3129
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3129
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.2.6
>         Environment: Any
>            Reporter: Jose CHILLAN
>   Original Estimate: 5 minutes
>  Remaining Estimate: 5 minutes
>
> When the "onCollectionRecreate" is invoked on an Interceptor, the getRole() method returns null. After investigation, 
> the problem is located in the class CollectionEntry in one of its constructors and is easily solved using the patch :
> public CollectionEntry(CollectionPersister persister, PersistentCollection collection) 
> {
>   // new collections that get found + wrapped
>   // during flush shouldn't be ignored
>   ignore = false;
>   collection.clearDirty(); //a newly wrapped collection is NOT dirty (or we get unnecessary version updates)
>   snapshot = persister.isMutable() ?  collection.getSnapshot(persister) : null;
>   // -- ADDED LINE HERE --
>   role = persister.getRole();
>   collection.setSnapshot(loadedKey, role, snapshot);
> }
> Thanks

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list