[hibernate-dev] Number of SQL statements

2017-09-22 Thread Thomas Reinhardt
Hello Hibernate Team, is there a good way to check in a junit test which number of sql statements are generated ? I want to tackle some of the lazy loading/class enhancement issues and those need good tests of course. Somehow related: I have a (rather trivial) fix for HHH-7842 (Hibernate Crit

Re: [hibernate-dev] Number of SQL statements

2017-09-22 Thread Vlad Mihalcea
Hi, 1. To validate the number of SQL statements, use this SQL Statement count validator I explained in this article: https://vladmihalcea.com/2014/02/01/how-to-detect-the-n-plus-one-query-problem-during-testing/ 2. For Hibernate Criteria, I don't think you should bother since it will be removed

Re: [hibernate-dev] Number of SQL statements

2017-09-22 Thread Sanne Grinovero
Hi Thomas, I can't answer your question - will leave that to the people working on Hibernate ORM - but let me share that I'd also love to see such a tool or an example for unit tests (integration tests) to assert that some specific piece of code won't be generating more than N database round trips

Re: [hibernate-dev] Number of SQL statements

2017-09-22 Thread Steve Ebersole
For such assertions in the Hibernate test suite we generally rely on Hibernate Statistics. I also really like Vlad's solution. On Fri, Sep 22, 2017 at 10:19 AM Sanne Grinovero wrote: > Hi Thomas, > > I can't answer your question - will leave that to the people working > on Hibernate ORM - but

Re: [hibernate-dev] Number of SQL statements

2017-09-22 Thread Vlad Mihalcea
HI, We already have such tool for the Hibernate tests. The one that I suggested does not use FlexyPool, but datasource-proxy. Vlad On Fri, Sep 22, 2017 at 5:55 PM, Sanne Grinovero wrote: > Hi Thomas, > > I can't answer your question - will leave that to the people working > on Hibernate ORM -