I have few basic questions here:
1. How are you getting the Question Id as string when the id is defined as
Key ? If you are using KeyFactory.keyToString(), the stringToKey() should be
able to give you the Key back right ?

2. If you have had your question id as encoded string key, you can then
directly use the string key and retrieve the object without the parent id.
Is that correct ?

Please help me clarify.

Thanks,
Uday.

On Tue, Aug 18, 2009 at 2:43 AM, Jason (Google) <[email protected]> wrote:

> 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