Issue Details (XML | Word | Printable)

Key: NUCCORE-821
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Ludovic Galibert
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus Core

HashSet removeAll() does not remove the elements in the database

Created: 15/Mar/12 10:56 AM   Updated: 30/Mar/12 09:25 AM   Resolved: 17/Mar/12 08:37 AM
Component/s: Persistence
Affects Version/s: 3.0.9
Fix Version/s: 3.0.10, 3.1.0.m2

File Attachments: 1. Zip Archive testcase-hashset-removeAll.zip (3 kB)

Environment: Oracle 11g (11.2.0.1.0) on Windows Server 2008 R2, standard OJDBC driver

Datastore: Oracle
Severity: Development


 Description  « Hide
There is an issue in org.datanucleus.store.types.sco.backed.HashSet.
When trying to remove a collection from a persistent hashset using removeAll(), the elements are not removed from the join table in the database.

The elements are removed from the delegate at the beginning of the method. However if there is a backing store and a queued update should be performed, each element is checked and backingSuccess is set to true only if the call "contains(element)" returns true. Since useCache=true and isCacheLoaded=true DataNucleus checks if the delegate contains the element but it was removed already earlier so contains() returns false and the elements are not removed from the database.

A simple workaround for this is to iterate over all elements to remove and simply call "remove(element)" but it is not really feasible to enforce this everywhere in an application.

Ludovic Galibert made changes - 15/Mar/12 10:57 AM
Field Original Value New Value
Attachment testcase-hashset-removeAll.zip [ 11607 ]
Andy Jefferson added a comment - 17/Mar/12 08:37 AM
SVN trunk and branches/3.0 pass that

Andy Jefferson made changes - 17/Mar/12 08:37 AM
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 3.0.10 [ 11501 ]
Fix Version/s 3.1.0.m2 [ 11506 ]
Resolution Fixed [ 1 ]
Andy Jefferson made changes - 30/Mar/12 09:25 AM
Status Resolved [ 5 ] Closed [ 6 ]