Available in versions: Dev (3.21) | Latest (3.20) | 3.19 | 3.18 | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12 | 3.11

Rendering Configuration

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

Rendering SQL from an expression tree is jOOQ's core feature. The following set of settings govern various functional and cosmetic rendering features:

Functional rendering settings

  • renderDefaultNullability: Whether non-explicit nullability should be rendered in DDL exports.
  • renderImplicitWindowRange: Whether any implicit window range clause should be rendered to help standardise SQL behaviour across dialects.
  • renderOrderByRownumberForEmulatedPagination: Whether ROW_NUMBER based LIMIT emulation should apply an explicit ORDER BY clause for row number ordering.
  • renderOutputForSQLServerReturningClause: Whether to use OUTPUT in SQL Server to emulate RETURNING clauses.
  • renderParenthesisAroundSetOperationQueries: Whether to render parentheses around set operations.
  • renderPlainSQLTemplatesAsRaw: Whether to process plain SQL templates are render them as raw templates.
  • renderVariablesInDerivedTablesForEmulations: Whether variables and expressions should be rendered in derived tables in order to prevent repetition of expressions in certain situations.

Cosmetic rendering settings

  • renderFormatted: Whether rendered SQL should be formatted (e.g. for debugging) or rendered on a single line (e.g. to send to the JDBC driver).
  • renderFormatting: A set of formatting related values, such as the newline character, the indentation string, the print margin width.
  • renderOptionalAsKeywordForFieldAliases: Whether the optional AS keyword should be rendered for field aliases.
  • renderOptionalAsKeywordForTableAliases: Whether the optional AS keyword should be rendered for table aliases.
  • renderOptionalAssociativityParentheses: Whether optional parentheses around associative operators should be maintained.
  • renderOptionalInnerKeyword: Whether the optional INNER keyword should be rendered for INNER JOIN operators.
  • renderOptionalOuterKeyword: Whether the optional OUTER keyword should be rendered for INNER JOIN operators.

Example configuration

Settings settings = new Settings()
    .withRenderFormatted(true)                           // Defaults to false
    .withRenderFormatting(new RenderFormatting()
        .withNewline("\\r\\n")                           // Defaults to \n
        .withIndentation("\\t"))                         // Defaults to "  "
    

Feedback

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

The jOOQ Logo