define Cow as

class Cow {
@PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key id;

        @Persistent
    @Extension(vendorName="datanucleus", key="gae.parent-pk",
value="true")
    private Key farmKey;

}
If you set farmKey to farm id then both farm and cow will be in the
same entity group.

this code should work:

tx.begin()

Farm f = getFarm();
Cow c = new Cow();
c.setFarmKey(f.getId());
f.incCowCounter();
pm.makePersistent(c);  //if you need to know new cow id.

tx.commit();


Andrey



-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to