Available in versions: Dev (3.20) | Latest (3.19)

Inline database implementation

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

Instead of providing your own Database implementation as a pre-compiled class to the code generation classpath, you can also provide an inline implementation (see in-memory compilation for more details):

XML (standalone and maven)
Programmatic
Gradle (Kotlin)
Gradle (Groovy)
Gradle (third party)
<configuration>
  <generator>
    <database>
      <name>com.example.MyDatabase</name>
      <java>package com.example;

import org.jooq.meta.AbstractDatabase;

public class MyDatabase extends AbstractDatabase {
    ...
}</java>
    </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()
      .withName("com.example.MyDatabase")
      .withJava("""package com.example;

import org.jooq.meta.AbstractDatabase;

public class MyDatabase extends AbstractDatabase {
    ...
}""")
    )
  )

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

import org.jooq.meta.jaxb.*


configuration {
  generator {
    database {
      name = "com.example.MyDatabase"
      java = """package com.example;

import org.jooq.meta.AbstractDatabase;

public class MyDatabase extends AbstractDatabase {
    ...
}"""
    }
  }
}

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

configuration {
  generator {
    database {
      name = "com.example.MyDatabase"
      java = """package com.example;

import org.jooq.meta.AbstractDatabase;

public class MyDatabase extends AbstractDatabase {
    ...
}"""
    }
  }
}

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

generationTool {
  generator {
    database {
      name = "com.example.MyDatabase"
      java = """package com.example;

import org.jooq.meta.AbstractDatabase;

public class MyDatabase extends AbstractDatabase {
    ...
}"""
    }
  }
}

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

Make sure your custom database's dependencies are available to the code generator as a code generator dependency

Feedback

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

The jOOQ Logo