[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2344) Persistent collection queued operation ignored with lazy inverse one-to-many collection.

Gail Badner (JIRA) noreply at atlassian.com
Wed Sep 26 16:35:57 EDT 2007


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

Gail Badner commented on HHH-2344:
----------------------------------

Please attach a runnable test case (Java + mapping).

> Persistent collection queued operation ignored with lazy inverse one-to-many collection.
> ----------------------------------------------------------------------------------------
>
>                 Key: HHH-2344
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2344
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.2.1
>         Environment: Hibernate 3.2.1
>            Reporter: Sebastien Robert
>
> I load an Object that contains a lazy inverse collection (one-to-many).
> Hibernate wrap my collection with a PersistentMap
> There is objects in the collection in the database but in my case the PersistentMap is not yet initialized.
> I perform a remove operation on the persistentMap with a known key of one of the objects.
> The map is not initialized (and the relation is an inverse one-to-many) so the map queue the removeOperation.
> I perform a get operation with the same key and the value is still returned.
> If we look closer at what happened in the PersistentMap, it's look like this.
> //*****
> public Object remove(Object key) {
>     if ( isPutQueueEnabled() ) {                             // This returned true, the
>                                                                                    // map is not yet                     
>                                                                                    // initialized
>      Object old = readElementByIndex( key );      // This method triggered
>                                                                                    // an initialization of the                   
>                                                                                    // map.
>                                                                                    // Queued operation are
>                                                                                    // processed in the after
>                                                                                    // init method
>      queueOperation( new Remove( key, old ) );  // The remove operation   
>                                                                                      // is queued.
>      return old;
>    }
>    ....
> //*******
> When i perform the get operation on the map the map is now initialized. The get is processed by the underlying map and the value is returned. The queued operation is completely ignored.
> Currently i fixed my code by performing a containsKey before the remove . The containsKey initialize the map and then the remove do not queue the operation. But by looking at all the PersistentCollection it seem that i may have the same problem using put and remove with other persistentCollection.

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