Catch N+1 Queries Automatically in Hibernate 7: Statistics, datasource-proxy and a JUnit Guard
Reproduce an N+1 on Hibernate 7.4, see why Hibernate Statistics reports 1 query while 11 reach the database, compare five fixes by measured statement count, and fail the build with a JUnit 6 @MaxSelects guard.