I have the following 3 classes.  How can I make the Party as part of both
Tenant and GlAccountOrganization classes.

public class Party {
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    @Extension(vendorName="datanucleus", key="gae.encoded-pk", value="true")
    private String id;
..
}

public class Tenant {
...
private String name;
private List<Party> partyList;
}

public class GlAccountOrganization {
....
private Party party;
...
}


I do the following in the JDOTestCase
    public void testGlAccountOrganization() {

        beginTxn();
        Tenant tenant = new Tenant();
        tenant.setName("vs");
        Party party = new Party();
        tenant.add(party);
        pm.makePersistent(tenant);
        commitTxn();

        beginTxn();
        GlAccountOrganization gl = new GlAccountOrganization();
        gl.setOrganizationParty(party);
        pm.makePersistent(gl);
        commitTxn();
    }
Detected attempt to establish GlAccountOrganization(2) as the parent of
Tenant("vs")/Party(1) but the entity identified by Tenant("vs")/Party(1) is
already a child of Tenant("vs").  A parent cannot be established or changed
once an object has been persisted.
org.datanucleus.store.appengine.FatalNucleusUserException: Detected attempt
to establish GlAccountOrganization(2) as the parent of Tenant("vs")/Party(1)
but the entity identified by Tenant("vs")/Party(1) is already a child of
Tenant("vs").  A parent cannot be established or changed once an object has
been persisted.

thanks
-Aswath
--
You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to