google app engine - Key.create vs. ofy().load() -


i want key entity (i don't need actual entity. need key child entity).

so know there 2 ways of doing it:

// 1. key<thing> tkey = com.googlecode.objectify.key.create(thing.class, id);  // 2. key<thing> tkey = ofy().load().type(thing.class).id(id); 

what's difference between them? what's faster? 1 should use?

would answer change if had well:

thing t = tkey.get(); 

you want use key.create(thing, id).

ofy().load().type(thing.class).id(id) returns ref<thing>, not key<thing>. loads thing out of datastore, not want.


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -