Files
java-interview-lab/experienced-2-3y/output/05-jpa.txt
T

15 lines
750 B
Plaintext

== Q25: N+1 selects ==
data: 5 customers, 12 orders (4 customers x 3 orders, plus one customer with none)
lazy loop (default) : total = 2400, SQL statements = 6
JOIN FETCH query : total = 2400, SQL statements = 1
@EntityGraph("orders") : total = 2400, SQL statements = 1
== Q26: LazyInitializationException ==
no @Transactional around the loop -> LazyInitializationException
message: Cannot lazily initialize collection of role 'com.ankurm.interviewlab.exp23.spring.Customer.orders' with key '1' (no session)
== Q27: a DTO projection with LEFT JOIN ==
OrderTotal[name=Asha, total=600]
OrderTotal[name=Kiran, total=600]
OrderTotal[name=Meera, total=600]
OrderTotal[name=Nobody, total=0]
OrderTotal[name=Ravi, total=600]