MountainClimb / datanucleus-appengine

Automatically exported from code.google.com/p/datanucleus-appengine
0 stars 0 forks source link

JDO Stale children don't get deleted when storing new ArrayList<Child>() #218

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a 1-n parent child relationship with a listproperty: private 
List<Child> children = new ArrayList<Child>();
2. on a detached parent object reset the array completely with: 
parent.setChildren(new ArrayList<Child>());
3. make the detached object persistent
4. note that the old children still exist, new children in the new array list 
only get appended to the list

What is the expected output? What do you see instead?
The expected output should be similar to as if you're using an 
ArrayList<String>() where if the list gets cleared or completely reset all the 
old entities in the list are actually gone from the datastore.

What version of the product are you using? 1.0.7
On what operating system? Win7

Please provide any additional information below.
Attached is a sample eclipse project that replicates and isolates the 
behaviour. Run JDOTestModelTest testChildrenAreDeletedWhenListIsReset() to see 
it fail. The TestCase also shows how children can't be removed from an array 
list when makePersistent is not performed within a transaction.
The issue seems somewhat related to Issue 179.

Original issue reported on code.google.com by pfiste...@gmail.com on 2 Aug 2010 at 5:37

Attachments:

GoogleCodeExporter commented 8 years ago
how about just providing the basic test model class(es) and the test 
persistence code, hence something more like 10k to download rather than 10Mb

Original comment by googleco...@yahoo.co.uk on 21 Sep 2011 at 3:58

GoogleCodeExporter commented 8 years ago
Can't reproduce, and no simple testcase provided. The "related" issue 
referenced was marked fixed some time ago

Original comment by googleco...@yahoo.co.uk on 29 Feb 2012 at 12:11