All versions: 3.11 | 3.10 | 3.9 | Development versions: 3.12

The code generator supports a set of annotations on generated code, which can be turned on using the following flags. These annotations include:

The flags governing the generation of these annotations are:

XML configuration (standalone and Maven)

<configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-3.11.0.xsd">
  <generator>
    <generate>
      <jpaAnnotations>true</jpaAnnotations>
      <jpaVersion>2.2</jpaVersion>
      <validationAnnotations>true</validationAnnotations>
      <springAnnotations>true</springAnnotations>
    </generate>
  </generator>
</configuration>

Programmatic configuration

configuration
  .withGenerator(new Generator(
    .withGenerate(new Generate()
      .withJpaAnnotations(true)
      .withJpaVersion("2.2")
      .withValidationAnnotations(true)
      .withSpringAnnotations(true))));

Gradle configuration

myConfigurationName(sourceSets.main) {
  generator {
    generate {
      jpaAnnotations = true
      jpaVersion = '2.2'
      validationAnnotations = true
      springAnnotations = true
    }
  }
}
The jOOQ Logo