Posts

Showing posts with the label hibernate.show_sql

Viewing the SQL Query in liferay : debugging the SQL Query in Hibernate

Sometimes we have to know SQL query hiting in DB to retrieve the list. Suppose When we are writing the DynamicQuery , Some times we have to know SQL query it is generating to hit DB. So generally it is useful when we are debugging the Query it is generated. In hibernate we used the write the property in XML file as hibernate.show.sql to view the query. In Liferay also we can also set the below property to true in the portal-ext.properties to view the SQL query at the console. hibernate.show_sql=true. By adding the above property it will just reterive the parameters. What if we want to display the parameters. Add the below properties in log4j.properties it will display the paramters also. # logs the SQL statements #log4j.logger.org.hibernate.SQL=debug # Logs the JDBC parameters passed to a query #log4j.logger.org.hibernate.type=trace In Liferay log4j is located in the below location tomcat-7.0.42\webapps\ROOT\WEB-INF\classes Also we want t...