I created a Maven project in my eclipse IDE and trying to write simple hibernate program. But I am not able to see the final query that is generated by hibernate which also includes the bind parameters.
I also followed the post mentioned here : Hibernate show real SQL , but it did not help.
I have below configurations:
In my hibernate.cfg.xml
file I have:
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<property name="use_sql_comments">true</property>
I also placed log4j.properties
file with its contents:
log4j.logger.org.hibernate=INFO, hb
log4j.logger.org.hibernate.SQL=DEBUG
log4j.logger.org.hibernate.type=TRACE
log4j.logger.org.hibernate.hql.ast.AST=info
log4j.logger.org.hibernate.tool.hbm2ddl=warn
log4j.logger.org.hibernate.hql=debug
log4j.logger.org.hibernate.cache=info
log4j.logger.org.hibernate.jdbc=debug
log4j.logger.net.sf.hibernate.type=debug
log4j.appender.hb=org.apache.log4j.ConsoleAppender
log4j.appender.hb.layout=org.apache.log4j.PatternLayout
log4j.appender.hb.layout.ConversionPattern=HibernateLog --> %d{HH:mm:ss} %-5p %c - %m%n
log4j.appender.hb.Threshold=TRACE
Both hibernate.cfg.xml
and log4j.properties
are placed at path :
MyProject/src/main/java/log4j.properties
But still when I run a small program I am not able to see the bind parameters that are added by hibernate, I am just seeing below results:
Hibernate:
select
this_.ID as ID1_0_0_,
this_.NAME as NAME2_0_0_
from
MY_TABLE this_
I am using Hibernate-4.3