zenmeso / objectify-appengine

Automatically exported from code.google.com/p/objectify-appengine
MIT License
0 stars 0 forks source link

Enable loading of entities with dynamic types #217

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Support for something like:
ofy().load().<Thing>kind("thingId").filter(...
would be useful, and when you are working with meta-data queries is a must.

They idea is to allow loading of entities in a non type-safe way, after 
querying their kind with a meta-query. 

Original issue reported on code.google.com by sh...@storee.us on 11 Aug 2014 at 4:23

GoogleCodeExporter commented 9 years ago

Original comment by lhori...@gmail.com on 3 Oct 2014 at 6:01

GoogleCodeExporter commented 9 years ago
Can you describe this in some more detail? I don't understand.

Original comment by lhori...@gmail.com on 27 Nov 2014 at 7:21

GoogleCodeExporter commented 9 years ago
Let's say I run a meta query to get all kinds in a specific namespace. 
The kind name is a string that equals a java class name. 
I have no way of pulling the entities even though I know thier kind, and a 
parent class they inherit from in java. 
This would allow me to fetch these entites and manipulate them. 

Original comment by shuky.ka...@gmail.com on 27 Nov 2014 at 7:44

GoogleCodeExporter commented 9 years ago
You can load any entity by key. If you have a kind, parent, and id, you can 
construct a vanilla datastore Key using KeyFactory. Then you can make an 
Objectify key via Key.create(datastoreKey) and load that like this:

ofy().load().key(objectifyKey).now()

Or you could just pass in the native datastore key to:

ofy().load().value(datastoreKey).now()

If you wanted to make this prettier you could subclass your own LoaderImpl and 
add the methods you like.

Original comment by lhori...@gmail.com on 4 Dec 2014 at 5:34

GoogleCodeExporter commented 9 years ago
When working with meta queries you can't get keys, only kinds
This is really useful when working with namespaces.
instead of loading everything, I just want to run queries.

E. G.

The type of query I am looking for in ofy is instead of doing:
ofy().load().type(Thing.class).filter(...).list
Just doing:
ofy().load().type("Thing").filter(...).list

Shuky.

Original comment by sh...@storee.us on 4 Dec 2014 at 6:33