[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-3223) PersistentMap.remove() incorrect on uninitialized, non-extra-lazy map

Michael Newcomb (JIRA) noreply at atlassian.com
Mon Aug 18 13:55:38 EDT 2008


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3223?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Newcomb updated HHH-3223:
---------------------------------

    Attachment: hhh-3223.zip

Execute 'Bug' and you will see the bug demonstrated. The first remove is 'lost'. It does remove the item in memory but nothing is sent to the database and upon a reload from the database (closing the entity manager) the item that was removed is now back again.

Please fix this bug, I have applied the patch to a local copy of PersistentMap.java and everything works as normal. Actually, if the Hibernate developer will just look at PersistenMap.put() (it suffered from the same bug) they can see the problem and can apply the patch directly from the PersistentMap.put() method.

> PersistentMap.remove() incorrect on uninitialized, non-extra-lazy map
> ---------------------------------------------------------------------
>
>                 Key: HHH-3223
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3223
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.3.0.CR1
>            Reporter: Michael Newcomb
>         Attachments: hhh-3223.zip
>
>   Original Estimate: 1 minute
>  Remaining Estimate: 1 minute
>
> Please have a look at PersistentMap.remove() and compare it to PersistentMap.put(). The put() was fixed HHH-2476 and the same fix needs to be applied to remove().
> Please refer to HHH-2584 for the patch: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2584
> Copied from HHH-2584:
> Essentially, an uninitialized PersistentMap loses the first remove() into it if defined as non-extra-lazy.
> The underlying cause is the code in PersistentMap#remove() which attempts to readElementByIndex(). In the case of non-extra-lazy, readElementByIndex() returns the UNKNOWN marker object which is supposed to be used to signal that the delegate map is now initialized and to remove the element directly from the map. Long story short, PersistentMap#remove() does not properly check the return value from readElementByIndex() and react accordingly.
> WORKAROUND:
> Have a copy of PersistentMap.java in your source tree with the patch applied...
> 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