Search code examples
jooqjooq-codegen-maven

How to configure jooq to generate particular table with all types


How do we need to add configuration so that jooq generates only a specific table that is configured and it should include all types also.

In the existing project they have disabled table generation  <includeTables>false</includeTables> , but now i need a particular table to be generated. If I enable it to be true, then it generates all the tables. So i have tried using  <includes>Table_Name</includes> after this it generates only that particular table and all other stuff like udts types are not generated.


Solution

  • There's a pending feature request to enhance the <includes> and <excludes> regular expressions to allow for applying them per object type: https://github.com/jOOQ/jOOQ/issues/5263. Currently, this is not possible.

    But your <includes> regular expression could include the table and all the UDTs that you need, e.g.

    <includes>
      table_name
    | udt_name_1
    | udt_name_2
    </includes>
    

    Alternatively, provide full qualification as needed:

    <includes>
      schema1\.table_name
    | schema2\.udt_name_1
    | schema3\.udt_name_2
    </includes>
    

    Note that regular expressions are case sensitive by default. Use (?i:...) to make them case insensitive.