In short, yes. That said, in practice, I haven't seen very deep entity
hierarchies since there are performance implications with deep entity
groups, so hopefully that won't be a huge inconvenience for you.
- Jason

On Fri, Aug 14, 2009 at 3:36 AM, Smrky <[email protected]> wrote:

>
> Yes, that was what I was asking - so for getting a specific question I
> need both - survey ID and question ID. But what if I had deeper level
> child - I would have to keep IDs of all parents? i.e.:
>
> parent1 -> parent2 -> parent3 -> parent4 -> parent5 -> child
>
> public child getChildByID(parent1ID, parent2ID, parent3ID, parent4ID,
> parent5ID, childID) {
>         PersistenceManager pm = PMFactory.get().getPersistenceManager
> ();
>         Key kp = KeyFactory.createKey(parent1.class.getSimpleName(),
> parent1ID);
>        Key k = kp.getChild(parent2.class.getSimpleName(),
> parent2).getChild(parent3.class.getSimpleName(), parent3).getChild
> (parent4.class.getSimpleName(), parent4).getChild
> (parent5.class.getSimpleName(), parent5).getChild
> (child.class.getSimpleName(), childID);
>
>        child c = (child) pm.getObjectById(child.class, k);
>        pm.retrieve(c);
>        pm.close();
>        return c;
> }
>
> Is it correct? Or there is another way? Thank you!
>
> On 13 srp, 18:01, objectuser <[email protected]> wrote:
> > Right, the ID of the Question is not a Long, it's a Key.  So if you
> > keep the question's key value somewhere (I'm assuming you can since
> > you have the survey ID somewhere), you can do pm.getObjectById
> > (Question.class, questionKey).
> >
> > For the relationship, just ignore me since I'm just wrong. :)
> >
>

--~--~---------~--~----~------------~-------~--~----~
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