inspect - How I can configure StatementInspector in Hibernate? -


https://docs.jboss.org/hibernate/orm/5.2/javadocs/org/hibernate/interceptor.html says onpreparestatement(string sql) deprecated. supply statementinspector instead, if wish inspect , alter sql statements.

but not clear how can configure statementinspector in hibernate @ application level (i don't want set @ each hibernate session level).

don't )

you need 2 things:

  1. add property persistence.xml:

property name="hibernate.session_factory.statement_inspector" value="full-qualified class name"

  1. write listener class implementing interface org.hibernate.resource.jdbc.spi.statementinspector.

profit!


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -