Thanks Ikai. I have an entity that has a bunch of Text properties,
they can each be quite large. I wanted to avoid loading them if
they're not going to be used for a specific query. For example, I have
a list of GameRoom objects:

    class GameRoom {
       String gamename;
       String mapname;

       Text bigChunkOfJson1;
       Text bigChunkOfJson2;
       Text bigChunkOfJson3;
    }

If a user wants to get a listing of games my service is hosting, it's
probably not wise for me to deserialize each "bigChunkOfJson" property
to give them a simple game listing. Only if they join a game do I need
to touch those Text properties. I read the Relationships page again
and it seems that child objects are lazy loaded:

"Child objects are loaded from the datastore when they are accessed
for the first time. If you do not access the child object on a parent
object, the entity for the child object is never loaded. If you want
to load the child, you can either "touch" it before closing the
PersistenceManager (e.g. by calling getContactInfo() in the above
example) or explicitly add the child field to the default fetch group
so it's retrieved and loaded with the parent"

So I figure I could split my class up like:

    class Game {
        String gamename;
        String mapname;

        MoreInfo more;
     }

So if I query for Game instances, so long as I don't access the
MoreInfo object, that data won't be fetched (if I understand
correctly). Then I can put all my Text objects in that class,

Thanks

http://code.google.com/appengine/docs/java/datastore/relationships.html



On Nov 11, 3:56 pm, "Ikai Lan (Google)" <ikai.l+gro...@google.com>
wrote:
> Text properties were never actually lazy loaded. We only lazy loaded them to
> match the JDO/JPA spec. In practice, the entire entity was being read and we
> just weren't populating the entity.
>
> Try running AppStats - though I suspect the deserialization shouldn't be
> *that* slow.
>
> --
> Ikai Lan
> Developer Programs Engineer, Google App Engine
> Blogger:http://googleappengine.blogspot.com
> Reddit:http://www.reddit.com/r/appengine
> Twitter:http://twitter.com/app_engine
>
>
>
>
>
>
>
> On Thu, Nov 11, 2010 at 8:38 AM, Mark <mar...@gmail.com> wrote:
> > Hi,
>
> > Is a Text property lazy loaded when I query for an instance of that
> > class? It seems to not be lazy loaded as of 2008, wondering if that's
> > still the case?:
>
> >http://groups.google.com/group/google-appengine/browse_thread/thread/...
>
> > I ask because I'm wondering if a query for a class is spending time
> > deserializing my large Text properties, or waiting until I actually
> > access them (if ever) after the query is already performed,
>
> > Thanks
>
> > --
> > 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<google-appengine-java%2B 
> > unsubscr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine-java?hl=en.

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