Manipulating enums
jOOQ represents an SQL enum type (for example, the MySQL enum
or PostgreSQL enum
data type created via CREATE TYPE
) via an interface named org.jooq.EnumType
. Whenever the jOOQ Java Code Generator detects the usage of an SQL enum type, it automatically generates a Java enum that implements EnumType
. For instance, the MySQL schema of the SALE
table contains the following enum
data type:
'vat' ENUM ('NONE', 'MIN', 'MAX') DEFAULT NULL
For vat
, the jOOQ generator renders the jooq.generated.enums.VatType
enum, as follows:
public enum VatType implements EnumType { NONE("NONE"), MIN("MIN"), MAX("MAX"); private final String literal; private VatType(String literal) { this.literal = literal; } @Override public...