Available in versions: Dev (3.20) | Latest (3.19) | 3.18 | 3.17 | 3.16 | 3.15

This documentation is for the unreleased development version of jOOQ. Click on the above version links to get this documentation for a supported version of jOOQ.

Comments

Applies to ❌ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

jOOQ's code generator will pick up comments on schema objects created with the COMMENT statement and generate Javadocs accordingly.

If your dialect does not support the COMMENT statement, or your schema doesn't have comments, or you want to amend / replace the schema comments in the code generator, this section will show you how to add "synthetic" comments to your schema objects.

XML (standalone and maven)
Programmatic
Gradle (Kotlin)
Gradle (Groovy)
Gradle (third party)
<configuration>
  <generator>
    <database>
      <comments>
        <comment>

          <!-- Regular expression matching all objects that have this comment. -->
          <expression>CONFIGURED_COMMENT_TABLE</expression>

          <!-- Whether the comment is a deprecation notice. Defaults to false. -->
          <deprecated>true</deprecated>

          <!-- Whether the original schema comment should be included. Defaults to true. -->
          <includeSchemaComment>false</includeSchemaComment>

          <!-- The actual comment text. Defaults to no message. -->
          <message>Do not use this table.</message>
        </comment>
      </comments>
    </database>
  </generator>
</configuration>

See the configuration XSD, standalone code generation, and maven code generation for more details.

new org.jooq.meta.jaxb.Configuration()
  .withGenerator(new Generator()
    .withDatabase(new Database()
      .withComments(
        new CommentType()

          // Regular expression matching all objects that have this comment.
          .withExpression("CONFIGURED_COMMENT_TABLE")

          // Whether the comment is a deprecation notice. Defaults to false.
          .withDeprecated(true)

          // Whether the original schema comment should be included. Defaults to true.
          .withIncludeSchemaComment(false)

          // The actual comment text. Defaults to no message.
          .withMessage("Do not use this table.")
      )
    )
  )

See the configuration XSD and programmatic code generation for more details.

import org.jooq.meta.jaxb.*


configuration {
  generator {
    database {
      comments {
        comment {

          // Regular expression matching all objects that have this comment.
          expression = "CONFIGURED_COMMENT_TABLE"

          // Whether the comment is a deprecation notice. Defaults to false.
          isDeprecated = true

          // Whether the original schema comment should be included. Defaults to true.
          isIncludeSchemaComment = false

          // The actual comment text. Defaults to no message.
          message = "Do not use this table."
        }
      }
    }
  }
}

See the configuration XSD and gradle code generation for more details.

configuration {
  generator {
    database {
      comments {
        comment {

          // Regular expression matching all objects that have this comment.
          expression = "CONFIGURED_COMMENT_TABLE"

          // Whether the comment is a deprecation notice. Defaults to false.
          deprecated = true

          // Whether the original schema comment should be included. Defaults to true.
          includeSchemaComment = false

          // The actual comment text. Defaults to no message.
          message = "Do not use this table."
        }
      }
    }
  }
}

See the configuration XSD and gradle code generation for more details.

generationTool {
  generator {
    database {
      comments {
        comment {

          // Regular expression matching all objects that have this comment.
          expression = "CONFIGURED_COMMENT_TABLE"

          // Whether the comment is a deprecation notice. Defaults to false.
          deprecated = true

          // Whether the original schema comment should be included. Defaults to true.
          includeSchemaComment = false

          // The actual comment text. Defaults to no message.
          message = "Do not use this table."
        }
      }
    }
  }
}

See the configuration XSD and gradle code generation for more details.

As always, when regular expressions are used, they are regular expressions with default flags.

References to this page

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo