Issue Details (XML | Word | Printable)

Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Hooman Valibeigi
Votes: 0
Watchers: 0

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

Loss of all collection elements on add+remove

Created: 17/Aug/14 02:02 PM   Updated: 16/Oct/14 12:26 PM
Component/s: None
Affects Version/s: 3.2.13
Fix Version/s: None

Datastore: PostgreSQL
Severity: Development

 Description  « Hide
I came across this situation where an add+remove operation on the same instance of collection causes all the elements of the collection to be removed.


class A
    Set<B> bs;

    // With getters and setters

And have already persisted an A (a1) with two Bs (b1, b2)

The following code causes all elements to be removed

Set<B> bs = a1.getBs();
B b3 = new B();

However the following code works fine. Results in 2 Bs (b2, b3) still in a1

B b3 = new B();

The difference is the number of times getBs() is called.

I will post a testcase later.

Sort Order: Ascending order - Click to sort in descending order
Hooman Valibeigi added a comment - 17/Aug/14 02:57 PM

Hooman Valibeigi added a comment - 24/Aug/14 01:58 PM
Hi Andy,

I know this is not the place to argue over project templating, however I had my own reasons not to follow the test-jdo template. You may find them justifiable

1- I run my tests in a main method (using Junit's TestRunner) instead of running them at mvn test phase. If an assertion fails it won't disrupt the compilation phase and I can always do 'mvn install' before actually running the tests. In fact my tests are also Junit 4 compatible.

2- I felt a need for multiple maven modules at some point and since then I kept using that structure to report bugs. One example was this It was necessary to have multiple maven modules to reproduce that bug.

3- I am more comfortable with hg than git in windows.

Andy Jefferson added a comment - 24/Aug/14 02:40 PM
If you are more comfortable with that format then fine ... you run the test, download the code from GitHub, and work out where the problem is, and provide a patch. That's how open source is supposed to work.

Hooman Valibeigi added a comment - 24/Aug/14 05:34 PM
If it makes a difference here is a testcase based on your template

For NUCCORE-1234, my previous comment still applies. It's not something you can test with 'mvn test' that easy. It requires an osgi runtime. Maybe you can use my template for osgi tests from now on.

Hooman Valibeigi added a comment - 16/Oct/14 12:26 PM
Also affects version 4.0.2