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

Working with embedded keys

As part of the embeddable types introduced in Chapter 7, Types, Converters, and Bindings, we have jOOQ-embedded keys. An embedded key is materialized by the jOOQ Code Generator into the implementation of the jOOQ org.jooq.EmbeddableRecord interface and a handy POJO class. An embedded key extends the default implementation of the org.jooq.EmbeddableRecord interface, which is org.jooq.impl.EmbeddableRecordImpl.

We can define embedded keys for primary and unique keys. Practically, we indicate to jOOQ the primary/unique keys that should become embedded keys, and jOOQ will generate the corresponding artifacts for each primary/unique key, as well as for each foreign key referencing these primary/unique keys. Roughly, embedded keys mirror the primary/unique keys and the corresponding foreign keys in Java classes.

However, in order to employ embedded keys, we need the following configuration:

// Maven and standalone
<database>
  ...
 ...
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