[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3488) CascadingAction.PERSIST.getCascadableChildrenIterator method loading uninitialized collections

Siarhei Yarashevich (JIRA) noreply at atlassian.com
Thu Jul 23 12:56:12 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3488?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33658#action_33658 ] 

Siarhei Yarashevich commented on HHH-3488:
------------------------------------------

I think, this fix should be applied as soon as possible, the current code can cause serious bugs.
I tried to apply the following code for CascadingAction.PERSIST.getCascadableChildrenIterator and rebuild hibernate jar with this fix.

public Iterator getCascadableChildrenIterator(EventSource session, CollectionType collectionType, Object collection) {
// persists don't cascade to uninitialized collections
return CascadingAction.getLoadedElementsIterator(session, collectionType, collection);
}

I ran unit tests, provided with hibernate distribution, the results were exactly the same, as for old code.

> CascadingAction.PERSIST.getCascadableChildrenIterator method loading uninitialized collections
> ----------------------------------------------------------------------------------------------
>
>                 Key: HHH-3488
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3488
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core, documentation
>    Affects Versions: 3.3.1
>         Environment: Hibernate version 3.3.1 GA, DB2 version 9
>            Reporter: Debra Zarley
>
> public Iterator getCascadableChildrenIterator(EventSource session, CollectionType collectionType, Object collection) {
> // persists don't cascade to uninitialized collections
> return CascadingAction.getAllElementsIterator(session, collectionType, collection);
> }
> Looks like either the javadoc or the code is incorrect.  I am guessing the code, since it makes sense that only loaded collections should be affected.  I think it should be:
> public Iterator getCascadableChildrenIterator(EventSource session, CollectionType collectionType, Object collection) {
> // persists don't cascade to uninitialized collections
> return CascadingAction.getLoadedElementsIterator(session, collectionType, collection);
> }

-- 
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