添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
oracle.jdbc.OracleDriver jdbc:oracle:thin:@[your jdbc connection parameters] [your database user] [your database password] user[db-user] password[db-password] org.jooq.meta.oracle.OracleDatabase UNUSED_TABLE # This table (unqualified name) should not be generated | PREFIX_.* # Objects with a given prefix should not be generated | SECRET_SCHEMA\.SECRET_TABLE # This table (qualified name) should not be generated | SECRET_ROUTINE # This routine (unqualified name) ... [your database schema / owner / name] org.jooq.your.packagename /path/to/your/dir

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

new org.jooq.meta.jaxb.Configuration()
  // Configure the database connection here
  .withJdbc(new Jdbc()
    .withDriver("oracle.jdbc.OracleDriver")
    .withUrl("jdbc:oracle:thin:@[your jdbc connection parameters]")
    .withUser("[your database user]")
    .withPassword("[your database password]")
    // You can also pass user/password and other JDBC properties in the optional properties tag:
    .withProperties(
      new Property()
        .withKey("user")
        .withValue("[db-user]"),
      new Property()
        .withKey("password")
        .withValue("[db-password]")
  .withGenerator(new Generator()
    .withDatabase(new Database()
      // The database dialect from jooq-meta. Available dialects are
      // named org.jooq.meta.[database].[database]Database.
      // Natively supported values are:
      // org.jooq.meta.ase.ASEDatabase
      // org.jooq.meta.auroramysql.AuroraMySQLDatabase
      // org.jooq.meta.aurorapostgres.AuroraPostgresDatabase
      // org.jooq.meta.cockroachdb.CockroachDBDatabase
      // org.jooq.meta.db2.DB2Database
      // org.jooq.meta.derby.DerbyDatabase
      // org.jooq.meta.firebird.FirebirdDatabase
      // org.jooq.meta.h2.H2Database
      // org.jooq.meta.hana.HANADatabase
      // org.jooq.meta.hsqldb.HSQLDBDatabase
      // org.jooq.meta.ignite.IgniteDatabase
      // org.jooq.meta.informix.InformixDatabase
      // org.jooq.meta.ingres.IngresDatabase
      // org.jooq.meta.mariadb.MariaDBDatabase
      // org.jooq.meta.mysql.MySQLDatabase
      // org.jooq.meta.oracle.OracleDatabase
      // org.jooq.meta.postgres.PostgresDatabase
      // org.jooq.meta.redshift.RedshiftDatabase
      // org.jooq.meta.snowflake.SnowflakeDatabase
      // org.jooq.meta.sqldatawarehouse.SQLDataWarehouseDatabase
      // org.jooq.meta.sqlite.SQLiteDatabase
      // org.jooq.meta.sqlserver.SQLServerDatabase
      // org.jooq.meta.sybase.SybaseDatabase
      // org.jooq.meta.teradata.TeradataDatabase
      // org.jooq.meta.trino.TrinoDatabase
      // org.jooq.meta.vertica.VerticaDatabase
      // This value can be used to reverse-engineer generic JDBC DatabaseMetaData (e.g. for MS Access)
      // org.jooq.meta.jdbc.JDBCDatabase
      // This value can be used to reverse-engineer standard jOOQ-meta XML formats
      // org.jooq.meta.xml.XMLDatabase
      // This value can be used to reverse-engineer schemas defined by SQL files
      // (requires jooq-meta-extensions dependency)
      // org.jooq.meta.extensions.ddl.DDLDatabase
      // This value can be used to reverse-engineer schemas defined by JPA annotated entities
      // (requires jooq-meta-extensions-hibernate dependency)
      // org.jooq.meta.extensions.jpa.JPADatabase
      // This value can be used to reverse-engineer schemas defined by Liquibase migration files
      // (requires jooq-meta-extensions-liquibase dependency)
      // org.jooq.meta.extensions.liquibase.LiquibaseDatabase
      // You can also provide your own org.jooq.meta.Database implementation
      // here, if your database is currently not supported
      .withName("org.jooq.meta.oracle.OracleDatabase")
      // All elements that are generated from your schema (A Java regular expression.
      // Use the pipe to separate several expressions) Watch out for
      // case-sensitivity. Depending on your database, this might be
      // important!
      // You can create case-insensitive regular expressions using this syntax: (?i:expr)
      // Whitespace is ignored and comments are possible.
      .withIncludes(".*")
      // All elements that are excluded from your schema (A Java regular expression.
      // Use the pipe to separate several expressions). Excludes match before
      // includes, i.e. excludes have a higher priority
      .withExcludes("""
           UNUSED_TABLE                # This table (unqualified name) should not be generated
         | PREFIX_.*                   # Objects with a given prefix should not be generated
         | SECRET_SCHEMA\.SECRET_TABLE # This table (qualified name) should not be generated
         | SECRET_ROUTINE              # This routine (unqualified name) ...
      // The schema that is used locally as a source for meta information.
      // This could be your development schema or the production schema, etc
      // This cannot be combined with the schemata element.
      // If left empty, jOOQ will generate all available schemata. See the
      // manual's next section to learn how to generate several schemata
      .withInputSchema("[your database schema / owner / name]")
    // Generation flags: See advanced configuration properties
    .withGenerate()
    .withTarget(new Target()
      // The destination package of your generated classes (within the
      // destination directory)
      // jOOQ may append the schema name to this package if generating multiple schemas,
      // e.g. org.jooq.your.packagename.schema1
      // org.jooq.your.packagename.schema2
      .withPackageName("org.jooq.your.packagename")
      // The destination directory of your generated classes
      .withDirectory("/path/to/your/dir")

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

import org.jooq.meta.jaxb.*
configuration {
  // Configure the database connection here
  jdbc {
    driver = "oracle.jdbc.OracleDriver"
    url = "jdbc:oracle:thin:@[your jdbc connection parameters]"
    user = "[your database user]"
    password = "[your database password]"
    // You can also pass user/password and other JDBC properties in the optional properties tag:
    properties {
      property {
        key = "user"
        value = "[db-user]"
      property {
        key = "password"
        value = "[db-password]"
  generator {
    database {
      // The database dialect from jooq-meta. Available dialects are
      // named org.jooq.meta.[database].[database]Database.
      // Natively supported values are:
      // org.jooq.meta.ase.ASEDatabase
      // org.jooq.meta.auroramysql.AuroraMySQLDatabase
      // org.jooq.meta.aurorapostgres.AuroraPostgresDatabase
      // org.jooq.meta.cockroachdb.CockroachDBDatabase
      // org.jooq.meta.db2.DB2Database
      // org.jooq.meta.derby.DerbyDatabase
      // org.jooq.meta.firebird.FirebirdDatabase
      // org.jooq.meta.h2.H2Database
      // org.jooq.meta.hana.HANADatabase
      // org.jooq.meta.hsqldb.HSQLDBDatabase
      // org.jooq.meta.ignite.IgniteDatabase
      // org.jooq.meta.informix.InformixDatabase
      // org.jooq.meta.ingres.IngresDatabase
      // org.jooq.meta.mariadb.MariaDBDatabase
      // org.jooq.meta.mysql.MySQLDatabase
      // org.jooq.meta.oracle.OracleDatabase
      // org.jooq.meta.postgres.PostgresDatabase
      // org.jooq.meta.redshift.RedshiftDatabase
      // org.jooq.meta.snowflake.SnowflakeDatabase
      // org.jooq.meta.sqldatawarehouse.SQLDataWarehouseDatabase
      // org.jooq.meta.sqlite.SQLiteDatabase
      // org.jooq.meta.sqlserver.SQLServerDatabase
      // org.jooq.meta.sybase.SybaseDatabase
      // org.jooq.meta.teradata.TeradataDatabase
      // org.jooq.meta.trino.TrinoDatabase
      // org.jooq.meta.vertica.VerticaDatabase
      // This value can be used to reverse-engineer generic JDBC DatabaseMetaData (e.g. for MS Access)
      // org.jooq.meta.jdbc.JDBCDatabase
      // This value can be used to reverse-engineer standard jOOQ-meta XML formats
      // org.jooq.meta.xml.XMLDatabase
      // This value can be used to reverse-engineer schemas defined by SQL files
      // (requires jooq-meta-extensions dependency)
      // org.jooq.meta.extensions.ddl.DDLDatabase
      // This value can be used to reverse-engineer schemas defined by JPA annotated entities
      // (requires jooq-meta-extensions-hibernate dependency)
      // org.jooq.meta.extensions.jpa.JPADatabase
      // This value can be used to reverse-engineer schemas defined by Liquibase migration files
      // (requires jooq-meta-extensions-liquibase dependency)
      // org.jooq.meta.extensions.liquibase.LiquibaseDatabase
      // You can also provide your own org.jooq.meta.Database implementation
      // here, if your database is currently not supported
      name = "org.jooq.meta.oracle.OracleDatabase"
      // All elements that are generated from your schema (A Java regular expression.
      // Use the pipe to separate several expressions) Watch out for
      // case-sensitivity. Depending on your database, this might be
      // important!
      // You can create case-insensitive regular expressions using this syntax: (?i:expr)
      // Whitespace is ignored and comments are possible.
      includes = ".*"
      // All elements that are excluded from your schema (A Java regular expression.
      // Use the pipe to separate several expressions). Excludes match before
      // includes, i.e. excludes have a higher priority
      excludes = """
           UNUSED_TABLE                # This table (unqualified name) should not be generated
         | PREFIX_.*                   # Objects with a given prefix should not be generated
         | SECRET_SCHEMA\.SECRET_TABLE # This table (qualified name) should not be generated
         | SECRET_ROUTINE              # This routine (unqualified name) ...
      // The schema that is used locally as a source for meta information.
      // This could be your development schema or the production schema, etc
      // This cannot be combined with the schemata element.
      // If left empty, jOOQ will generate all available schemata. See the
      // manual's next section to learn how to generate several schemata
      inputSchema = "[your database schema / owner / name]"
    // Generation flags: See advanced configuration properties
    generate {}
    target {
      // The destination package of your generated classes (within the
      // destination directory)
      // jOOQ may append the schema name to this package if generating multiple schemas,
      // e.g. org.jooq.your.packagename.schema1
      // org.jooq.your.packagename.schema2
      packageName = "org.jooq.your.packagename"
      // The destination directory of your generated classes
      directory = "/path/to/your/dir"

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

configuration {
  // Configure the database connection here
  jdbc {
    driver = "oracle.jdbc.OracleDriver"
    url = "jdbc:oracle:thin:@[your jdbc connection parameters]"
    user = "[your database user]"
    password = "[your database password]"
    // You can also pass user/password and other JDBC properties in the optional properties tag:
    properties {
      property {
        key = "user"
        value = "[db-user]"
      property {
        key = "password"
        value = "[db-password]"
  generator {
    database {
      // The database dialect from jooq-meta. Available dialects are
      // named org.jooq.meta.[database].[database]Database.
      // Natively supported values are:
      // org.jooq.meta.ase.ASEDatabase
      // org.jooq.meta.auroramysql.AuroraMySQLDatabase
      // org.jooq.meta.aurorapostgres.AuroraPostgresDatabase
      // org.jooq.meta.cockroachdb.CockroachDBDatabase
      // org.jooq.meta.db2.DB2Database
      // org.jooq.meta.derby.DerbyDatabase
      // org.jooq.meta.firebird.FirebirdDatabase
      // org.jooq.meta.h2.H2Database
      // org.jooq.meta.hana.HANADatabase
      // org.jooq.meta.hsqldb.HSQLDBDatabase
      // org.jooq.meta.ignite.IgniteDatabase
      // org.jooq.meta.informix.InformixDatabase
      // org.jooq.meta.ingres.IngresDatabase
      // org.jooq.meta.mariadb.MariaDBDatabase
      // org.jooq.meta.mysql.MySQLDatabase
      // org.jooq.meta.oracle.OracleDatabase
      // org.jooq.meta.postgres.PostgresDatabase
      // org.jooq.meta.redshift.RedshiftDatabase
      // org.jooq.meta.snowflake.SnowflakeDatabase
      // org.jooq.meta.sqldatawarehouse.SQLDataWarehouseDatabase
      // org.jooq.meta.sqlite.SQLiteDatabase
      // org.jooq.meta.sqlserver.SQLServerDatabase
      // org.jooq.meta.sybase.SybaseDatabase
      // org.jooq.meta.teradata.TeradataDatabase
      // org.jooq.meta.trino.TrinoDatabase
      // org.jooq.meta.vertica.VerticaDatabase
      // This value can be used to reverse-engineer generic JDBC DatabaseMetaData (e.g. for MS Access)
      // org.jooq.meta.jdbc.JDBCDatabase
      // This value can be used to reverse-engineer standard jOOQ-meta XML formats
      // org.jooq.meta.xml.XMLDatabase
      // This value can be used to reverse-engineer schemas defined by SQL files
      // (requires jooq-meta-extensions dependency)
      // org.jooq.meta.extensions.ddl.DDLDatabase
      // This value can be used to reverse-engineer schemas defined by JPA annotated entities
      // (requires jooq-meta-extensions-hibernate dependency)
      // org.jooq.meta.extensions.jpa.JPADatabase
      // This value can be used to reverse-engineer schemas defined by Liquibase migration files
      // (requires jooq-meta-extensions-liquibase dependency)
      // org.jooq.meta.extensions.liquibase.LiquibaseDatabase
      // You can also provide your own org.jooq.meta.Database implementation
      // here, if your database is currently not supported
      name = "org.jooq.meta.oracle.OracleDatabase"
      // All elements that are generated from your schema (A Java regular expression.
      // Use the pipe to separate several expressions) Watch out for
      // case-sensitivity. Depending on your database, this might be
      // important!
      // You can create case-insensitive regular expressions using this syntax: (?i:expr)
      // Whitespace is ignored and comments are possible.
      includes = ".*"
      // All elements that are excluded from your schema (A Java regular expression.
      // Use the pipe to separate several expressions). Excludes match before
      // includes, i.e. excludes have a higher priority
      excludes = """
           UNUSED_TABLE                # This table (unqualified name) should not be generated
         | PREFIX_.*                   # Objects with a given prefix should not be generated
         | SECRET_SCHEMA\.SECRET_TABLE # This table (qualified name) should not be generated
         | SECRET_ROUTINE              # This routine (unqualified name) ...
      // The schema that is used locally as a source for meta information.
      // This could be your development schema or the production schema, etc
      // This cannot be combined with the schemata element.
      // If left empty, jOOQ will generate all available schemata. See the
      // manual's next section to learn how to generate several schemata
      inputSchema = "[your database schema / owner / name]"
    // Generation flags: See advanced configuration properties
    generate {}
    target {
      // The destination package of your generated classes (within the
      // destination directory)
      // jOOQ may append the schema name to this package if generating multiple schemas,
      // e.g. org.jooq.your.packagename.schema1
      // org.jooq.your.packagename.schema2
      packageName = "org.jooq.your.packagename"
      // The destination directory of your generated classes
      directory = "/path/to/your/dir"

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

generationTool {
  // Configure the database connection here
  jdbc {
    driver = "oracle.jdbc.OracleDriver"
    url = "jdbc:oracle:thin:@[your jdbc connection parameters]"
    user = "[your database user]"
    password = "[your database password]"
    // You can also pass user/password and other JDBC properties in the optional properties tag:
    properties {
      property {
        key = "user"
        value = "[db-user]"
      property {
        key = "password"
        value = "[db-password]"
  generator {
    database {
      // The database dialect from jooq-meta. Available dialects are
      // named org.jooq.meta.[database].[database]Database.
      // Natively supported values are:
      // org.jooq.meta.ase.ASEDatabase
      // org.jooq.meta.auroramysql.AuroraMySQLDatabase
      // org.jooq.meta.aurorapostgres.AuroraPostgresDatabase
      // org.jooq.meta.cockroachdb.CockroachDBDatabase
      // org.jooq.meta.db2.DB2Database
      // org.jooq.meta.derby.DerbyDatabase
      // org.jooq.meta.firebird.FirebirdDatabase
      // org.jooq.meta.h2.H2Database
      // org.jooq.meta.hana.HANADatabase
      // org.jooq.meta.hsqldb.HSQLDBDatabase
      // org.jooq.meta.ignite.IgniteDatabase
      // org.jooq.meta.informix.InformixDatabase
      // org.jooq.meta.ingres.IngresDatabase
      // org.jooq.meta.mariadb.MariaDBDatabase
      // org.jooq.meta.mysql.MySQLDatabase
      // org.jooq.meta.oracle.OracleDatabase
      // org.jooq.meta.postgres.PostgresDatabase
      // org.jooq.meta.redshift.RedshiftDatabase
      // org.jooq.meta.snowflake.SnowflakeDatabase
      // org.jooq.meta.sqldatawarehouse.SQLDataWarehouseDatabase
      // org.jooq.meta.sqlite.SQLiteDatabase
      // org.jooq.meta.sqlserver.SQLServerDatabase
      // org.jooq.meta.sybase.SybaseDatabase
      // org.jooq.meta.teradata.TeradataDatabase
      // org.jooq.meta.trino.TrinoDatabase
      // org.jooq.meta.vertica.VerticaDatabase
      // This value can be used to reverse-engineer generic JDBC DatabaseMetaData (e.g. for MS Access)
      // org.jooq.meta.jdbc.JDBCDatabase
      // This value can be used to reverse-engineer standard jOOQ-meta XML formats
      // org.jooq.meta.xml.XMLDatabase
      // This value can be used to reverse-engineer schemas defined by SQL files
      // (requires jooq-meta-extensions dependency)
      // org.jooq.meta.extensions.ddl.DDLDatabase
      // This value can be used to reverse-engineer schemas defined by JPA annotated entities
      // (requires jooq-meta-extensions-hibernate dependency)
      // org.jooq.meta.extensions.jpa.JPADatabase
      // This value can be used to reverse-engineer schemas defined by Liquibase migration files
      // (requires jooq-meta-extensions-liquibase dependency)
      // org.jooq.meta.extensions.liquibase.LiquibaseDatabase
      // You can also provide your own org.jooq.meta.Database implementation
      // here, if your database is currently not supported
      name = "org.jooq.meta.oracle.OracleDatabase"
      // All elements that are generated from your schema (A Java regular expression.
      // Use the pipe to separate several expressions) Watch out for
      // case-sensitivity. Depending on your database, this might be
      // important!
      // You can create case-insensitive regular expressions using this syntax: (?i:expr)
      // Whitespace is ignored and comments are possible.
      includes = ".*"
      // All elements that are excluded from your schema (A Java regular expression.
      // Use the pipe to separate several expressions). Excludes match before
      // includes, i.e. excludes have a higher priority
      excludes = """
           UNUSED_TABLE                # This table (unqualified name) should not be generated
         | PREFIX_.*                   # Objects with a given prefix should not be generated
         | SECRET_SCHEMA\.SECRET_TABLE # This table (qualified name) should not be generated
         | SECRET_ROUTINE              # This routine (unqualified name) ...
      // The schema that is used locally as a source for meta information.
      // This could be your development schema or the production schema, etc
      // This cannot be combined with the schemata element.
      // If left empty, jOOQ will generate all available schemata. See the
      // manual's next section to learn how to generate several schemata
      inputSchema = "[your database schema / owner / name]"
    // Generation flags: See advanced configuration properties
    generate {}
    target {
      // The destination package of your generated classes (within the
      // destination directory)
      // jOOQ may append the schema name to this package if generating multiple schemas,
      // e.g. org.jooq.your.packagename.schema1
      // org.jooq.your.packagename.schema2
      packageName = "org.jooq.your.packagename"
      // The destination directory of your generated classes
      directory = "/path/to/your/dir"

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

There are also lots of advanced configuration parameters, which will be treated in the manual's section about advanced code generation features. Note, you can find the official XSD file for a formal specification at:
https://www.jooq.org/xsd/jooq-codegen-3.19.8.xsd
  • jooq-3.19.10.jar, jooq-meta-3.19.10.jar, jooq-codegen-3.19.10.jar, reactive-streams-1.0.3.jar, r2dbc-spi-1.0.0.RELEASE.jar
  • The JDBC driver you configured
  • Put the XML configuration file, jooq*.jar and the JDBC driver into a directory, e.g. C:\temp\jooq
  • Go to C:\temp\jooq
  • Run java -cp jooq-3.19.10.jar;jooq-meta-3.19.10.jar;jooq-codegen-3.19.10.jar;reactive-streams-1.0.3.jar;r2dbc-spi-1.0.0.RELEASE.jar;[JDBC-driver].jar org.jooq.codegen.GenerationTool <XML-file>
  • this example uses jOOQ's log4j support by adding log4j.xml and log4j.jar to the project classpath.
  • the actual jooq-3.19.10.jar, jooq-meta-3.19.10.jar, jooq-codegen-3.19.10.jar artefacts may contain version numbers in the file names.
  • <!-- Specify the maven code generator plugin --> <!-- Use org.jooq for the Open Source Edition org.jooq.pro for commercial editions with Java 17 support, org.jooq.pro-java-11 for commercial editions with Java 11 support, org.jooq.pro-java-8 for commercial editions with Java 8 support, org.jooq.trial for the free trial edition with Java 17 support, org.jooq.trial-java-11 for the free trial edition with Java 11 support, org.jooq.trial-java-8 for the free trial edition with Java 8 support Note: Only the Open Source Edition is hosted on Maven Central. Install the others locally using the provided scripts, or access them from here: https://repo.jooq.org --> <groupId>org.jooq</groupId> <artifactId>jooq-codegen-maven</artifactId> <version>3.19.10</version> <!-- The plugin should hook into the generate goal --> <executions> <execution> <goals> <goal>generate</goal> </goals> </execution> </executions> <!-- Manage the plugin's dependency. In this example, we'll use a PostgreSQL database --> <dependencies> <dependency> <groupId>org.postgresql</groupId> <artifactId>postgresql</artifactId> <version>9.4.1212</version> </dependency> </dependencies> <!-- Specify the plugin configuration. The configuration format is the same as for the standalone code generator --> <configuration> <!-- JDBC connection parameters --> <driver>org.postgresql.Driver</driver> <url>jdbc:postgresql:postgres</url> <user>postgres</user> <password>test</password> </jdbc> <!-- Generator parameters --> <generator> <database> <name>org.jooq.meta.postgres.PostgresDatabase</name> <includes>.*</includes> <excludes></excludes> <!-- In case your database supports catalogs, e.g. SQL Server: <inputCatalog>public</inputCatalog> <inputSchema>public</inputSchema> </database> <target> <packageName>org.jooq.codegen.maven.example</packageName> <directory>target/generated-sources/jooq</directory> </target> </generator> </configuration> </plugin>