Hi Andrey, I'll try to answer your questions inline. First off, I'm using
these docs as reference:

http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/KeyFactory.Builder.html
http://code.google.com/appengine/docs/java/datastore/transactions.html


> It works. But there are couple things which bother me. First at all,
> there is some extra job here. I actually don't need instance of parent
> class (MyList).
> I have the parent key. Theoretically speaking, it is the only thing
> needed to maintain parent child relationship. MyList class may have
> more fields I don't need at all. So, I'd like to avoid reading them to
> memory.
>

You can do this with KeyFactory.Builder. Build a Key using the parent and
child Keys, then query using this Key. You can also use an ancestor query to
find multiple child items.


> Second concern is about line
>
> myList.items.add(item);
>
> what if MyList already has million of items? How efficient is add
> operation in this case.
>

It's O(Linear) in memory, but as far as saving goes, adding a new child
element is a single row write + index writes. It's not dependent on the
number of items you already have. We have a series of articles describing
here:

http://code.google.com/appengine/articles/datastore/overview.html


> Any thoughts? Is it possible to store child object using parent key
> only?
>

Yep. Use KeyFactory.Builder to build and set a Key.


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


-- 
Ikai Lan
Developer Relations, Google App Engine
Twitter: http://twitter.com/ikai
Delicious: http://delicious.com/ikailan

----------------
Google App Engine links:
Blog: http://googleappengine.blogspot.com
Twitter: http://twitter.com/app_engine
Reddit: http://www.reddit.com/r/appengine

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