code: private void checkUnicity(ValidationStampFilter filter) {
          // Check project vs branch
          if (filter.getProject() != null && filter.getBranch() != null) {
              throw new IllegalStateException("Filter cannot be associated with both a project and a branch.");
          }
          // Gets the existing filter for the name in this scope
          MapSqlParameterSource params = params("name", filter.getName())
                  .addValue("project", filter.getProject() != null ? filter.getProject().id() : null)
                  .addValue("branch", filter.getBranch() != null ? filter.getBranch().id() : null)
                  .addValue("id", filter.getId() != null && filter.getId().isSet() ? filter.id() : null);
          String sql;
          // Branch
          if (filter.getBranch() != null) {
              sql = "SELECT ID FROM VALIDATION_STAMP_FILTERS WHERE PROJECT IS NULL AND BRANCH = :branch AND NAME = :name";
          }
          // Project
          else if (filter.getProject() != null) {
              sql = "SELECT ID FROM VALIDATION_STAMP_FILTERS WHERE PROJECT = :project AND BRANCH IS NULL AND NAME = :name";
          }
          // Global
          else {
              sql = "SELECT ID FROM VALIDATION_STAMP_FILTERS WHERE PROJECT IS NULL AND BRANCH IS NULL AND NAME = :name";
          }
          // ID
          if (filter.getId() != null && filter.getId().isSet()) {
              sql += " AND ID <> :id";
          }
          // Check
          Optional<Integer> o = getOptional(
                  sql,
                  params,
                  Integer.class
          );
          if (o.isPresent()) {
              throw new ValidationStampFilterNameAlreadyDefinedException(filter.getName());
          }
      }
docs: Note: in H2, null columns are not taken into account in the index