code: public void batchAddEntities(String keyName1, String keyName2) {
      // [START batchAddEntities]
      Key key1 = datastore.newKeyFactory().setKind("MyKind").newKey(keyName1);
      Entity.Builder entityBuilder1 = Entity.newBuilder(key1);
      entityBuilder1.set("propertyName", "value1");
      Entity entity1 = entityBuilder1.build();
  
      Key key2 = datastore.newKeyFactory().setKind("MyKind").newKey(keyName2);
      Entity.Builder entityBuilder2 = Entity.newBuilder(key2);
      entityBuilder2.set("propertyName", "value2");
      Entity entity2 = entityBuilder2.build();
  
      try {
        datastore.add(entity1, entity2);
      } catch (DatastoreException ex) {
        if ("ALREADY_EXISTS".equals(ex.getReason())) {
          // at least one of entity1.getKey() and entity2.getKey() already exists
        }
      }
      // [END batchAddEntities]
    }
docs: [VARIABLE "my_key_name2"]