[hibernate-dev] SQL query interceptor

Steve Ebersole steve at hibernate.org
Wed Jun 8 10:07:25 EDT 2016

You mean like a org.hibernate.resource.jdbc.spi.StatementInspector?

On Wed, Jun 8, 2016 at 6:47 AM Vlad Mihalcea <mihalcea.vlad at gmail.com>

> Hi,
> During testing, it's very useful to have an SQL query interceptor that we
> can inspect to see if the generated SQL query contains a certain SQL
> clause.
> There are multiple ways we could implement this kind of feature:
> 1. We could add a public String[] getSQLQueries(); in the Statistics
> interface.
> 2. We could define a SQLStatementInterceptor interface that can be provided
> via some configuration property.
>    The SqlStatementLogger.logStatement could call the
> SQLStatementInterceptor as well.
> 3. We could provide a way to provide a custom SQLStatementLogger class, so
> that users can intercept statements via their custom SQLStatementLogger.
> Currently, the only solution is to overwrite the sqlStatementLogger field
> of the JdbcServicesImpl via Reflection, which is rather a hack.
> What do you think?
> Vlad
> _______________________________________________
> 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