Reader small image

You're reading from  jOOQ Masterclass

Product typeBook
Published inAug 2022
Reading LevelBeginner
PublisherPackt
ISBN-139781800566897
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Anghel Leonard
Anghel Leonard
author image
Anghel Leonard

Anghel Leonard is a Chief Technology Strategist and independent consultant with 20+ years of experience in the Java ecosystem. In daily work, he is focused on architecting and developing Java distributed applications that empower robust architectures, clean code, and high-performance. Also passionate about coaching, mentoring and technical leadership. He is the author of several books, videos and dozens of articles related to Java technologies.
Read more about Anghel Leonard

Right arrow

Handling embeddable types

Embeddable types represent a powerful feature introduced in jOOQ 3.14. Roughly, this feature gets materialized in synthetic UDTs that can be used with all databases supported by jOOQ. While PostgreSQL and Oracle support UDTs (we can use UDTs directly in Data Definition Language (DDL)), other databases including MySQL and SQL Server don't support UDTs. But via jOOQ embeddable types, we can work at the application level with synthetic UDTs for any database, and jOOQ will take care of the underlying aspects of mapping these types to the database.

An embeddable type mimics a UDT by synthetically wrapping one (usually more) database column in a generated org.jooq.EmbeddableRecord. For instance, we can wrap OFFICE.CITY, OFFICE.STATE, OFFICE.COUNTRY, OFFICE.TERRITORY, and OFFICE.ADDRESS_LINE_FIRST under an embeddable type named OFFICE_FULL_ADDRESS via the following configuration in the jOOQ Code Generator (here, for MySQL):

<embeddable>
 <!-...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
jOOQ Masterclass
Published in: Aug 2022Publisher: PacktISBN-13: 9781800566897

Author (1)

author image
Anghel Leonard

Anghel Leonard is a Chief Technology Strategist and independent consultant with 20+ years of experience in the Java ecosystem. In daily work, he is focused on architecting and developing Java distributed applications that empower robust architectures, clean code, and high-performance. Also passionate about coaching, mentoring and technical leadership. He is the author of several books, videos and dozens of articles related to Java technologies.
Read more about Anghel Leonard