surinder-insonix / datanucleus-appengine

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

Deletion of a 1:M child does not update parent reference, throws JDOFatalUserException upon parent query #271

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a 1:M parent:child relationship, e.g.

@PersistenceCapable(identityType = IdentityType.APPLICATION,detachable="true")
@FetchGroup(name="children", members={@Persistent(name="children")})
public class Parent implements Serializable {
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private String name;

    @Persistent(mappedBy = "parent", defaultFetchGroup = "false")
    @Element(dependent = "true")
    private List<Child> children;
}

@PersistenceCapable(identityType = IdentityType.APPLICATION,detachable="true")
@FetchGroup(name="parent", members={@Persistent(name="parent")})
public class Child implements Serializable {

    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private String name;

    @Persistent
    private Parent parent;
}

2. Persist a parent and a couple of children.  Delete one of the children 
directly, e.g.:

// Parent has 2 children (roger ramjet and mickey mouse)
Child c = pm.getObjectById(Child.class, "roger ramjet");
pm.deletePersistent(c);

3. Attempt to query parent with child fetch - JDOFatalUserException is thrown

pm.getFetchPlan().addGroup("children");
Parent p = pm.getObjectById(Parent.class, "mumma");

What is the expected output? What do you see instead?

When querying on the parent, I expect the query to return the parent with one 
child (mickey mouse) after roger ramjet is deleted.  When deleting, the parent 
references to the child should be updated accordingly.

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

OS: Ubuntu 10.04 LTS
datanucleus-appengine 2.0.1-SNAPSHOT (r842)
datanucleus-core 3.0.9
datanucleus-api-jdo 3.0.7
jdo-api 3.0.1

appengine 1.6.1.1

Please provide any additional information below.

TestCases attached - run testDeleteUserContentReplicaChild and 
testDeleteUserBrandingChild.  

When running against older versions, tests pass as expected - to do this use 
the pom-datanucleus-1.1.5.xml pom and modifying the UserTest jdoconfig.xml.

Original issue reported on code.google.com by robert.w...@metacdn.com on 29 Feb 2012 at 4:37

Attachments:

GoogleCodeExporter commented 8 years ago
I have no such problem with current code

Original comment by googleco...@yahoo.co.uk on 17 Mar 2012 at 6:03