Wagby issues SQL via Hibernate. This section explains how to check SQL using Hibernate's settings.

By adding the following line to log4j.properties, the SQL executed in system.log is output.

  1. Open wagbyapp \ webapps \ $ (APPNAME) \ WEB-INF \ classes \ log4j.properties file with a text editor.
  2. Activate the following line.(In the initial setting, the above line is a comment.It becomes effective by removing the leading "#".)
    log4j.logger.org.hibernate.SQL=DEBUG
  3. Restart the web application.SQL is recorded in logs \ system.log.

I will explain how to check HQL generated by Hibernate directly by changing hibernate.cfg.xml of the built application.

  1. Open wagbyapp \ webapps \ $ (APPNAME) \ WEB-INF \ classes \ hibernate.cfg.xml file with a text editor.
  2. Change the property element of this file.
    <hibernate-configuration>
      <session-factory>
        ...
        <property name="show_sql">true</property>
        ...
      </session-factory>
    </hibernate-configuration>
    
  3. Restart the web application.HQL appears on the console that started Tomcat.(Logs \ catalina.out are also recorded at the same time.)

The output SQL has the following form.This is precisely the HQL handled by Hibernate.

select jgroupid_0_."userid" as userid1_61_0_, jgroupid_0_."jgroupid" as jgroupid2_56_0_, jgroupid_0_."jgroupidjshid" as jgroupid3_0_ from "juser$jgroupid" jgroupid_0_ where jgroupid_0_."userid"=?

The condition part of the where clause is '?'.The actual value is not displayed.

Please check the SQL of the database side which contains the value in '?'.