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

PostgreSQL

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

The jooq-postgres-extensions module contains data types, converters, and bindings for the following data types:

  • hstore represents a key-value store (i.e. a Map<String, String>)

In order to access these data types, just add the following dependency to your project:

<dependency>
    <!-- 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. 
               Import the others manually from your distribution -->
    <groupId>org.jooq</groupId>
    <artifactId>jooq-extensions-postgres</artifactId>
    <version>3.16.6</version>
</dependency>

The data type extensions can be added as forced types like this:

XML (standalone and maven)
Programmatic
Gradle
<configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-3.16.5.xsd">
  <generator>
    <database>
      <forcedTypes>
        <forcedType>
          <userType>org.jooq.postgres.extensions.types.Hstore</userType>
          <binding>org.jooq.postgres.extensions.bindings.HstoreBinding</binding>
          <includeTypes>hstore</includeTypes>
        </forcedType>
      </forcedTypes>
    </database>
  </generator>
</configuration>
new org.jooq.meta.jaxb.Configuration()
  .withGenerator(new Generator()
    .withDatabase(new Database()
      .withForcedTypes(
        new ForcedType()
          .withUserType("org.jooq.postgres.extensions.types.Hstore")
          .withBinding("org.jooq.postgres.extensions.bindings.HstoreBinding")
          .withIncludeTypes("hstore")
      )
    )
  )
myConfigurationName(sourceSets.main) {
  generator {
    database {
      forcedTypes {
        forcedType {
          userType = 'org.jooq.postgres.extensions.types.Hstore'
          binding = 'org.jooq.postgres.extensions.bindings.HstoreBinding'
          includeTypes = 'hstore'
        }
      }
    }
  }
}

Feedback

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

The jOOQ Logo