Fetching relationships
I'm pretty sure that you're familiar with the one-to-one, one-to-many, and many-to-many relationships. An emblematic mapping of unidirectional one-to-many roughly looks like this:
public class SimpleProductLine implements Serializable { ... private List<SimpleProduct> products = new ArrayList<>(); } public class SimpleProduct implements Serializable { ... }
Moreover, when SimpleProduct
contains a reference to SimpleProductLine
, this is considered a bidirectional one-to-many relationship:
public class SimpleProduct implements Serializable { ... private SimpleProductLine productLine; }
If we have this POJO model, can we map the corresponding result set to it via the jOOQ API? The answer is definitely yes, and this can be done in several ways. From the fetchInto()
, fetchMap()
, and fetchGroups()
methods that you already saw to the record mappers...