code: public Key commit() {
      Datastore datastore = transaction.getDatastore();
      // [START commit]
      // create an entity
      KeyFactory keyFactory = datastore.newKeyFactory().setKind("MyKind");
      Key key = datastore.allocateId(keyFactory.newKey());
      Entity entity = Entity.newBuilder(key).set("description", "commit()").build();
  
      // add the entity and commit
      try {
        transaction.put(entity);
        transaction.commit();
      } catch (DatastoreException ex) {
        // handle exception
      }
      // [END commit]
  
      return key;
    }
docs: [TARGET commit()]