I am using hibernate for persistance. All my entities most od the associations are lazy and by default collections are lazy. I also have lot of criteria queries and because of lazy mapping I always face n+1 problem. Suppose I have item and bids the famous example by default bids are lazy , so in a criteria query If I select Items and I also needs bids for each item in this case I end up with n+1 select please tell me how can I avoid n+1 using criteria ?
Hibernate is doing this behind the scenes for you, right? So, you're not doing multiple queries, but instead, somewhere in a place where you're not controlling program execution, these n+1 selects are happening, right?
Just confirm this for me so I have a clear picture of your problem.