[hibernate-dev] Number of SQL statements

Steve Ebersole steve at hibernate.org
Fri Sep 22 11:47:06 EDT 2017


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 <sanne at hibernate.org>
wrote:

> 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. That would be extremely useful!
>
> Let me suggst to focus on the actual network round-trips though:
> looking at the number of statements being generated is misleading as
> Hibernate ORM is able to do many clever things with multiple
> statements; for example you might see many of them being logged but it
> could still be wrapping them all in a single batch, therefore not
> being a performance problem.
>
> Vlad could this be a feature of your Flexy Pool ? Would love to see
> such a feature as a JUnit Rule ...
>
> Thanks,
> Sanne
>
> On 22 September 2017 at 15:34, Thomas Reinhardt <thomas at reinhardt.com>
> wrote:
> >
> > 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
> > Criteria does not respect fetch mode, when alias is used). As this is
> > related to the now deprecated Hibernate Criteria API is there any chance
> > my fix gets accepted or should I spare my time?
> >
> >
> > Thanks,
> >      Thomas
> > _______________________________________________
> > hibernate-dev mailing list
> > hibernate-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/hibernate-dev
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>


More information about the hibernate-dev mailing list