Hibernate: how to enable show sql

By , last updated August 24, 2019

To see the SQL that your application sends to the database during the execution, insert the following property in your XML property file:

<bean id="sessionFactory"
		<property name="hibernateProperties">
				<prop key="hibernate.show_sql">true</prop>
		<property name="dataSource" ref="dbDataSource" />

This is preferably done in the text.xml as you test the application.

In production you can enable logging with log4j in log4j.properties:



Be the first to comment.

Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>