Files
hibernate-demo/n-plus-one-guard/output/02-n-plus-one-to-one.txt
T

20 lines
1.0 KiB
Plaintext

# N+1 on a lazy @ManyToOne: 30 books, 10 distinct authors
# Hibernate ORM 7.4.16.Final, datasource-proxy 1.11.1, H2, JDK 25
== Code: one HQL query for 30 books, then book.getAuthor().getName() for every book
datasource-proxy SELECT count : 11
Hibernate entityFetchCount : 10
== The statements, in order
sql> select b1_0.id,b1_0.author_id,b1_0.title from Book b1_0
sql> select a1_0.id,a1_0.name from Author a1_0 where a1_0.id=?
sql> select a1_0.id,a1_0.name from Author a1_0 where a1_0.id=?
sql> select a1_0.id,a1_0.name from Author a1_0 where a1_0.id=?
sql> select a1_0.id,a1_0.name from Author a1_0 where a1_0.id=?
sql> select a1_0.id,a1_0.name from Author a1_0 where a1_0.id=?
sql> select a1_0.id,a1_0.name from Author a1_0 where a1_0.id=?
sql> select a1_0.id,a1_0.name from Author a1_0 where a1_0.id=?
sql> select a1_0.id,a1_0.name from Author a1_0 where a1_0.id=?
sql> select a1_0.id,a1_0.name from Author a1_0 where a1_0.id=?
sql> select a1_0.id,a1_0.name from Author a1_0 where a1_0.id=?