Solving N+1 and Playing with LISTAGG (Oracle/H2)

Over the last few weeks, I’ve been tinkering with some parts of our persistence layer — mostly out of curiosity. I’ve been using Spring Data JPA forever, but recently I started pushing it into areas where the “happy path” begins to crumble: dynamic filtering, projections, and of course… the infamous N+1 problem. During this little experiment, I ended up rediscovering QueryDSL (yes, it still exists, still works, and is still pretty awesome). I also stumbled upon something fun: using LISTAGG (Oracle/H2) to flatten collections in a single query, avoiding N+1 without fetch-joining the universe.