[hibernate-dev] Number of SQL statements

Vlad Mihalcea mihalcea.vlad at gmail.com
Fri Sep 22 10:49:54 EDT 2017


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 in the future and the fix might not be backported to older versions.

You could use the JPA Criteria instead.

Vlad

On Fri, Sep 22, 2017 at 5:34 PM, 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
>


More information about the hibernate-dev mailing list