ebt_dev ebt_dev - 1 year ago 86
Java Question

How to put/get multiple entities at once in Google cloud Datastore using java

In the documentation, I didn't find how I can put or retrieve multiple entities at once. further, by using GQL, I was not able to execute queries such select * from k where __ key __ in ('key1','key2','key3').

Can any one help me please, how I can insert/ retrieve multiple entities at once using java??


Answer Source

In Cloud Datastore, a LookupRequest and CommitRequest allow multiple keys and entities, respectively, to be specified. For example:

LookupRequest request = LookupRequest.newBuilder()


CommitRequest request = CommitRequest.newBuilder()

These are slight variations on the examples given on these pages: https://cloud.google.com/datastore/docs/concepts/entities#Datastore_Retrieving_an_entity https://cloud.google.com/datastore/docs/concepts/entities#Datastore_Creating_an_entity

Cloud Datastore GQL does not currently support IN or writes.