Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I load all entities of a given kind from Cloud Datastore with Objectify?

I have about a hundred objects stored in the Cloud Datastore with Kind = Animal. I would like to get all Animals from the database via the low level API or with Objectify.

like image 381
Walt Dizzy Records Avatar asked Jan 13 '15 01:01

Walt Dizzy Records


1 Answers

With Objectify you can do the following:

List<Animal> animals = ofy().load().type(Animal.class).list();

Read the documentation on queries it explains in detail how to query the Datastore using Objectify. In some ways I find the Objectify documentation to be much simpler to understand and concise compared to the GAE documentation.

like image 77
elcid Avatar answered Sep 19 '22 10:09

elcid