Search code examples
springjooqjavax

jooq @NotNull validation for AutoIncrement


I am using JOOQ with Spring. I have table like this:

CREATE TABLE city (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT,
  name VARCHAR(45) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE INDEX `id_UNIQUE` (`id` ASC))
  ENGINE = InnoDB;

From this table JOOQ generates

@NotNull
public UInteger getId() {
    return this.id;
}

This will fail Javax validation @Valid.

There was google group Link and it was said it was fixed Link.

I am using JOOQ 3.9.1.

Am I doing something incorrectly?


Solution

  • Indeed, it seems that fix #5128 (which you've linked) only works for those databases that report identity columns as defaulted columns to jOOQ-meta.

    An additional fix will be required to exclude also "non-defaulted" identity columns from having this annotation generated: https://github.com/jOOQ/jOOQ/issues/6401