Add n-plus-one-guard module: detecting N+1 with Hibernate Statistics vs datasource-proxy, five fixes with statement counts, and a JUnit 6 @MaxSelects guard (Hibernate 7.4.16.Final, datasource-proxy 1.11.1)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b6R1spapM7nBteaqeo
This commit is contained in:
asmhatre
2026-11-17 00:48:25 +05:30
co-authored by Claude Sonnet 5.5
parent eab5461d86
commit 0db721805b
20 changed files with 851 additions and 0 deletions
@@ -0,0 +1,16 @@
# What the guard prints when a test regresses (BrokenFixture, @MaxSelects(2))
# Hibernate ORM 7.4.16.Final, datasource-proxy 1.11.1, H2, JDK 25
== Failure message
listAuthorsWithBookCount(): expected at most 2 SELECT statement(s) but 11 were sent.
1) select a1_0.id,a1_0.name from Author a1_0
2) select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id=?
3) select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id=?
4) select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id=?
5) select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id=?
6) select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id=?
7) select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id=?
8) select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id=?
9) select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id=?
10) select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id=?
11) select b1_0.author_id,b1_0.id,b1_0.title from Book b1_0 where b1_0.author_id=?