[hibernate-dev] SQL query interceptor
mihalcea.vlad at gmail.com
Wed Jun 8 10:10:23 EDT 2016
Thanks for the tip. I didn't know about it. I'll give it a try then.
On Wed, Jun 8, 2016 at 5:07 PM, Steve Ebersole <steve at hibernate.org> wrote:
> 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>
>> 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
>> There are multiple ways we could implement this kind of feature:
>> 1. We could add a public String getSQLQueries(); in the Statistics
>> 2. We could define a SQLStatementInterceptor interface that can be
>> 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?
>> hibernate-dev mailing list
>> hibernate-dev at lists.jboss.org
More information about the hibernate-dev