Available in versions: Dev (3.21) | Latest (3.20) | 3.19 | 3.18 | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12 | 3.11
This documentation is for the unreleased development version of jOOQ. Click on the above version links to get this documentation for a supported version of jOOQ.
Generated UDTs
Supported by ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
Every UDT in your database will generate a org.jooq.UDT implementation that looks like this:
public class AddressType extends UDTImpl<AddressTypeRecord> {
// The singleton UDT instance
public static final UAddressType U_ADDRESS_TYPE = new UAddressType();
// Every UDT attribute generates a static member
public static final UDTField<AddressTypeRecord, String> ZIP =
createField("ZIP", VARCHAR, U_ADDRESS_TYPE);
public static final UDTField<AddressTypeRecord, String> CITY =
createField("CITY", VARCHAR, U_ADDRESS_TYPE);
public static final UDTField<AddressTypeRecord, String> COUNTRY =
createField("COUNTRY", VARCHAR, U_ADDRESS_TYPE);
// [...]
}
Besides the org.jooq.UDT implementation, a org.jooq.UDTRecord implementation is also generated
public class AddressTypeRecord extends UDTRecordImpl<AddressTypeRecord> {
// Every attribute generates a getter and a setter
public void setZip(String value) {...}
public String getZip() {...}
public void setCity(String value) {...}
public String getCity() {...}
public void setCountry(String value) {...}
public String getCountry() {...}
// [...]
}
<configuration>
<generator>
<generate>
<!-- Generate the UDTs class, records and UDT literals for each UDT -->
<udts>true</udts>
</generate>
</generator>
</configuration>
See the configuration XSD, standalone code generation, and maven code generation for more details.
new org.jooq.meta.jaxb.Configuration()
.withGenerator(
new Generate()
// Generate the UDTs class, records and UDT literals for each UDT
.withUdts(true)
)
See the configuration XSD and programmatic code generation for more details.
import org.jooq.meta.jaxb.*
configuration {
generator {
generate {
// Generate the UDTs class, records and UDT literals for each UDT
isUdts = true
}
}
}
See the configuration XSD and gradle code generation for more details.
configuration {
generator {
generate {
// Generate the UDTs class, records and UDT literals for each UDT
udts = true
}
}
}
See the configuration XSD and gradle code generation for more details.
// The jOOQ-codegen-gradle plugin has been introduced in version 3.19. // Please use the official plugin instead of the third party plugin that was recommended before.
Feedback
Do you have any feedback about this page? We'd love to hear it!