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,5 @@
# join fetch on a collection + setMaxResults(3), 10 authors x 3 books
# Hibernate ORM 7.4.16.Final, datasource-proxy 1.11.1, H2, JDK 25
authors returned: 3, books loaded: 9
SELECT statements: 1
sql> select a1_0.id,b1_0.author_id,b1_0.id,b1_0.title,a1_0.name from (select a1_0.id,a1_0.name from Author a1_0 where exists(select 1 from Book b1_0 where a1_0.id=b1_0.author_id) order by a1_0.id offset ? rows fetch first ? rows only) a1_0(id,name) join Book b1_0 on a1_0.id=b1_0.author_id order by a1_0.id