code: private IncompleteKey getIncompleteKey(Object entity) {
      EntityMetadata entityMetadata = EntityIntrospector.introspect(entity.getClass());
      String kind = entityMetadata.getKind();
      ParentKeyMetadata parentKeyMetadata = entityMetadata.getParentKeyMetadata();
      DatastoreKey parentKey = null;
      IncompleteKey incompleteKey = null;
      if (parentKeyMetadata != null) {
        parentKey = (DatastoreKey) IntrospectionUtils.getFieldValue(parentKeyMetadata, entity);
      }
      if (parentKey != null) {
        incompleteKey = IncompleteKey.newBuilder(parentKey.nativeKey(), kind).build();
      } else {
        incompleteKey = IncompleteKey.newBuilder(datastore.getOptions().getProjectId(), kind)
            .setNamespace(getEffectiveNamespace()).build();
      }
      return incompleteKey;
    }
docs: Returns an IncompleteKey of the given entity.
  
  @param entity
  the entity
  @return the incomplete key