Available in versions: Dev (3.20) | Latest (3.19) | 3.18 | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12 | 3.11 | 3.10

Generated POJOs

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

Every table and view in your database will generate a POJO implementation that looks like this:

// JPA annotations can be generated, optionally
@javax.persistence.Table(name = "BOOK", schema = "TEST")
public class Book implements java.io.Serializable

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

    // JSR-303 annotations can be generated, optionally
    private Integer id;

    private Integer authorId;

    @Size(max = 400)
    private String title;

    // Every column generates a getter and a setter
    @Column(name = "ID", unique = true, nullable = false, precision = 7)
    public Integer getId() {
        return this.id;

    public void setId(Integer id) {
        this.id = id;

    // [...]

Flags influencing generated POJOs

These flags from the code generation configuration influence generated POJOs:

  • dateAsTimestamp: This influences all relevant getters and setters
  • unsignedTypes: This influences all relevant getters and setters
  • interfaces: If interfaces are generated, POJOs will implement them
  • immutablePojos: Immutable POJOs have final members and no setters. All members must be passed to the constructor
  • daos: POJOs are a pre-requisite for DAOs. If DAOs are generated, POJOs are generated as well
  • jpaAnnotations: JPA annotations are used on generated records (details here)
  • jpaVersion: Version of JPA specification is to be used to generate version-specific annotations. If it is omitted, the latest version is used by default. (details here)
  • pojosToString: Whether POJOs should have a generated toString() implementation.
  • pojosEqualsAndHashCode: Whether POJOs should have generated equals() and hashCode() implementations.
  • validationAnnotations: JSR-303 validation annotations are used on generated records (details here)

Flags controlling POJO generation

POJO generation can be activated using the pojos flag

References to this page


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

The jOOQ Logo