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
Post a Comment