public List<Entity> getMultiple(String firstKeyName, String secondKeyName) {
    Datastore datastore = transaction.getDatastore();
    // TODO change so that it's not necessary to hold the entities in a list for integration testing
    // [START getMultiple]
    KeyFactory keyFactory = datastore.newKeyFactory().setKind("MyKind");
    Key firstKey = keyFactory.newKey(firstKeyName);
    Key secondKey = keyFactory.newKey(secondKeyName);
    Iterator<Entity> entitiesIterator = transaction.get(firstKey, secondKey);
    List<Entity> entities = Lists.newArrayList();
    while (entitiesIterator.hasNext()) {
      Entity entity = entitiesIterator.next();
      // do something with the entity
      entities.add(entity);
    }
    transaction.commit();
    // [END getMultiple]
    return entities;
  }
public List < Entity > getMultiple ( String firstKeyName , String secondKeyName ) { Datastore datastore = transaction . getDatastore ( ) ; KeyFactory keyFactory = datastore . newKeyFactory ( ) . setKind ( "MyKind" ) ; Key firstKey = keyFactory . newKey ( firstKeyName ) ; Key secondKey = keyFactory . newKey ( secondKeyName ) ; Iterator < Entity > entitiesIterator = transaction . get ( firstKey , secondKey ) ; List < Entity > entities = Lists . newArrayList ( ) ; while ( entitiesIterator . hasNext ( ) ) { Entity entity = entitiesIterator . next ( ) ; entities . add ( entity ) ; } transaction . commit ( ) ; return entities ; }
[VARIABLE "my_second_key_name"]