user2213892 user2213892 - 1 year ago 60
Java Question

How and the best way to retrieve a single entity google app engine

I have two entity kinds (Person which has the properties first and last names; Second entity kind is Car which has the properties color and make). Using Java, how do I retrieve one specific entity (say the entity whos id/name is equal to 1) in the most efficient way? I have no built indexes and am using the default indexes Google app engine provides. Looking through google documentation, they provide examples of getting all records within a kind using a loop, but do not show how to get a specific entity.

Answer Source

Each entity has a key (either autogenerated or provided by you) and doing a datastore.get ( is the fastest way to fetch that entity. Any other query will generally be slower.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download