Available in versions: Dev (3.21) | Latest (3.20) | 3.19 | 3.18 | 3.17 | 3.16 | 3.15 | 3.14

Domain data types

Supported by ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

A DOMAIN type is a standard SQL way of declaring a type name to be associated with a set of restrictions on existing types, typically on Built-in data types. Domain types can be created using the CREATE DOMAIN statement. The simplest type just declares the base type it enhances, without any additional clauses or constraints:

CREATE DOMAIN email AS VARCHAR(256)

To get a hold of the backing DataType<String> for this domain type, the generated code can be used as follows:

DataType<String> emailType = Domains.EMAIL.getDataType();

Additional type safety can be achieved using embedded domains, in case of which:

DataType<EmailRecord> emailType = Domains.EMAIL.getDataType();

Feedback

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

The jOOQ Logo