code: static void validateOwnIdAttribute(EntityType entityType, Map<String, Attribute> ownAllAttrMap) {
      // Validate ID attribute
      Attribute ownIdAttr = entityType.getOwnIdAttribute();
      if (ownIdAttr != null) {
        // Validate that ID attribute is in the attributes list
        Attribute ownAttr = ownAllAttrMap.get(ownIdAttr.getIdentifier());
        if (ownAttr == null) {
          throw new MolgenisValidationException(
              new ConstraintViolation(
                  format(
                      "EntityType [%s] ID attribute [%s] is not part of the entity attributes",
                      entityType.getId(), ownIdAttr.getName())));
        }
  
        // Validate that ID attribute data type is allowed
        if (!AttributeUtils.isIdAttributeTypeAllowed(ownIdAttr)) {
          throw new MolgenisValidationException(
              new ConstraintViolation(
                  format(
                      "EntityType [%s] ID attribute [%s] type [%s] is not allowed",
                      entityType.getId(), ownIdAttr.getName(), ownIdAttr.getDataType().toString())));
        }
  
        // Validate that ID attribute is unique
        if (!ownIdAttr.isUnique()) {
          throw new MolgenisValidationException(
              new ConstraintViolation(
                  format(
                      "EntityType [%s] ID attribute [%s] is not a unique attribute",
                      entityType.getId(), ownIdAttr.getName())));
        }
  
        // Validate that ID attribute is not nillable
        if (ownIdAttr.isNillable()) {
          throw new MolgenisValidationException(
              new ConstraintViolation(
                  format(
                      "EntityType [%s] ID attribute [%s] cannot be nillable",
                      entityType.getId(), ownIdAttr.getName())));
        }
      } else {
        if (!entityType.isAbstract() && entityType.getIdAttribute() == null) {
          throw new MolgenisValidationException(
              new ConstraintViolation(
                  format("EntityType [%s] is missing required ID attribute", entityType.getId())));
        }
      }
    }
docs: Validate that the ID attribute owned by this entity is part of the owned attributes.
  
  @param entityType entity meta data
  @param ownAllAttrMap attribute identifier to attribute map
  @throws MolgenisValidationException if the ID attribute is not an entity attribute