© Anghel Leonard 2020
A. LeonardSpring Boot Persistence Best Practiceshttps://doi.org/10.1007/978-1-4842-5626-8_14

14. Queries

Anghel Leonard1 
(1)
Banesti, Romania
 

Item 103: How to Optimize SELECT DISTINCT via Hibernate-Specific HINT_PASS_DISTINCT_THROUGH

Consider the Author and Book entities involved in a bidirectional lazy one-to-many association. The data snapshot is shown in Figure 14-1 (there is one author who has written two books).
../images/487471_1_En_14_Chapter/487471_1_En_14_Fig1_HTML.jpg
Figure 14-1

Data snapshot (HINT_PASS_DISTINCT_THROUGH)

Further, let’s fetch the list of Author entities along with all their Book child entities. The fact is that the SQL-level result set size is given by the number ...

Get Spring Boot Persistence Best Practices: Optimize Java Persistence Performance in Spring Boot Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.