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

Annotations

Available in ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

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.12.0.xsd">
  <generator>
    <generate>
      <!-- Possible values for generatedAnnotationType
         - DETECT_FROM_JDK
         - JAVAX_ANNOTATION_GENERATED
         - JAVAX_ANNOTATION_PROCESSING_GENERATED -->
      <generatedAnnotation>true</generatedAnnotation>
      <generatedAnnotationType>DETECT_FROM_JDK</generatedAnnotationType>
      
      <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()
      // Possible values for generatedAnnotationType
      // - DETECT_FROM_JDK
      // - JAVAX_ANNOTATION_GENERATED
      // - JAVAX_ANNOTATION_PROCESSING_GENERATED 
      .withGeneratedAnnotation(true)
      .withGeneratedAnnotationType(DETECT_FROM_JDK)

      .withJpaAnnotations(true)
      .withJpaVersion("2.2")

      .withValidationAnnotations(true)
      .withSpringAnnotations(true))));

Gradle configuration

myConfigurationName(sourceSets.main) {
  generator {
    generate {
      // Possible values for generatedAnnotationType
      // - DETECT_FROM_JDK
      // - JAVAX_ANNOTATION_GENERATED
      // - JAVAX_ANNOTATION_PROCESSING_GENERATED 
      generatedAnnotation = true
      generatedAnnotationType = DETECT_FROM_JDK

      jpaAnnotations = true
      jpaVersion = '2.2'

      validationAnnotations = true
      springAnnotations = true
    }
  }
}
The jOOQ Logo