New versions: Dev (3.14) | Latest (3.13) | 3.12 | 3.11 | 3.10 | 3.9 | 3.8 | Old versions: 3.7 | 3.6 | 3.5 | 3.4 | 3.3 | 2.6

Generated records

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

Every table in your database will generate an org.jooq.Record implementation that looks like this:

// JPA annotations can be generated, optionally
@Table(name = "BOOK", schema = "TEST")
public class BookRecord extends UpdatableRecordImpl<BookRecord>

// An interface common to records and pojos can be generated, optionally
implements IBook {

    // Every column generates a setter and a getter
    public void setId(Integer value) {
        setValue(BOOK.ID, value);
    @Column(name = "ID", unique = true, nullable = false, precision = 7)
    public Integer getId() {
        return getValue(BOOK.ID);
    // More setters and getters
    public void setAuthorId(Integer value) {...}
    public Integer getAuthorId() {...}
    // Convenience methods for foreign key methods
    public void setAuthorId(AuthorRecord value) {
        if (value == null) {
            setValue(BOOK.AUTHOR_ID, null);
        else {
            setValue(BOOK.AUTHOR_ID, value.getValue(AUTHOR.ID));
    // Navigation methods
    public AuthorRecord fetchAuthor() {
        return create.selectFrom(AUTHOR).where(AUTHOR.ID.eq(getValue(BOOK.AUTHOR_ID))).fetchOne();
    // [...]

TableRecord vs UpdatableRecord

If primary key information is available to the code generator, an org.jooq.UpdatableRecord will be generated. If no such information is available, a org.jooq.TableRecord will be generated. Primary key information can be absent because:

  • The table is a view, which does not expose the underlying primary keys
  • The table does not have a primary key
  • The code generator configuration has turned off primary keys usage information usage through one of various flags (see below)
  • The primary key information is not available to the code generator

Flags influencing generated records

These flags from the code generation configuration influence generated records:

  • syntheticPrimaryKeys: This overrides existing primary key information to allow for "custom" primary key column sets, possibly promoting a TableRecord to an UpdatableRecord
  • overridePrimaryKeys: This overrides existing primary key information to allow for unique key to primary key promotion, possibly promoting a TableRecord to an UpdatableRecord
  • dateAsTimestamp: This influences all relevant getters and setters
  • unsignedTypes: This influences all relevant getters and setters
  • relations: This is needed as a prerequisite for navigation methods
  • daos: Records are a pre-requisite for DAOs. If DAOs are generated, records are generated as well
  • interfaces: If interfaces are generated, records will implement them
  • jpaAnnotations: JPA annotations are used on generated records

Flags controlling record generation

Record generation can be deactivated using the records flag

The jOOQ Logo