这将向您显示生成的SQL,但不会向您显示查询中包含的值。
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> <property name="hibernateProperties"> <props> <!-- show the sql without the parameters --> <prop key="hibernate.show_sql">true</prop> <!-- format the sql nice --> <prop key="hibernate.format_sql">true</prop> <!-- show the hql as comment --> <prop key="use_sql_comments">true</prop> </props> </property> </bean>