[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2975) Interceptor onFlushDirty collections - previous and current state the same instance

Rob West (JIRA) noreply at atlassian.com
Tue Feb 9 16:59:29 EST 2010


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

Rob West commented on HHH-2975:
-------------------------------

I'm not a hibernate developer (i.e. I don't work on the Hibernate source), but you might want to check out PersistentCollection.isDirty() and PersistentCollection.getStoredSnapshot(), assuming that you're getting is an instance of PersistentCollection.  The stored snapshot should (in my experience) contain the pre-modification view, whereas the collection itself has the new view.  At least, this is how I've always coded my interceptors.

> Interceptor onFlushDirty collections - previous and current state the same instance
> -----------------------------------------------------------------------------------
>
>                 Key: HHH-2975
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2975
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.2.2
>         Environment: Hibernate 3.2.2 - Oracle thin driver 10.1.0.4.0
>            Reporter: Clayton J. Kovar
>
> When calling Session.merge(entity)  {therefore the previous state is available}
> the interceptor's onFlushDirty is called and the previous state for all of the simple properties correctly passes the previous values but with a collection the same collection instance is passed in both the previous and current state arrays.  
> So far I have only seen this behavior on a Map with a one-to-many relationship to another entity.  I have not tried it yet with Lists, Sets, or Bags.
> I'm assuming this is not expected behavior, but please let me know if it is.
> Best regards.

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