# Five ways to load 10 authors with their books
# Hibernate ORM 7.4.16.Final, datasource-proxy 1.11.1, H2, JDK 25

== naive loop (lazy collection per author)
   sql> select a1_0.id,a1_0.name from Author a1_0
   sql> select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id=?
   sql> select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id=?
   sql> select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id=?
   sql> select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id=?
   sql> select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id=?
   sql> select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id=?
   sql> select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id=?
   sql> select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id=?
   sql> select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id=?
   sql> select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id=?

== join fetch
   sql> select a1_0.id,b1_0.author_id,b1_0.id,b1_0.title,a1_0.name from Author a1_0 join Book b1_0 on a1_0.id=b1_0.author_id

== entity graph (Author.withBooks)
   sql> select a1_0.id,b1_0.author_id,b1_0.id,b1_0.title,a1_0.name from Author a1_0 left join Book b1_0 on a1_0.id=b1_0.author_id

== batch fetching, size 5 (session.setFetchBatchSize)
   sql> select a1_0.id,a1_0.name from Author a1_0
   sql> select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id in (?,?,?,?,?)
   sql> select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id in (?,?,?,?,?)

== DTO projection (no entities)
   sql> select count(b1_0.id) from Book b1_0 group by b1_0.author_id

== SELECT statements for 10 authors x 3 books, same result every time (30 books)
naive loop (lazy collection per author)              11
join fetch                                           1
entity graph (Author.withBooks)                      1
batch fetching, size 5 (session.setFetchBatchSize)   3
DTO projection (no entities)                         1
