All versions: 3.11 | 3.10 | 3.9 | 3.8 | 3.7 | 3.6 | 3.5 | 3.4 | 3.3 | Development versions: 3.12 | Unsupported versions: 3.2 | 3.1 | 3.0 | 2.6

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

// JPA annotations can be generated, optionally
@javax.persistence.Entity
@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
    @NotNull
    private Integer id;

    @NotNull
    private Integer authorId;

    @NotNull
    @Size(max = 400)
    private String title;

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

    @Override
    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)
  • 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

The jOOQ Logo