1spring整合hibernate并.在hibernate的工厂sessionFactory加入下面的属性就可以打印了
<property name="hibernateProperties">
<props>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
例子:
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="namingStrategy">
<bean class="com.daren.common.hibernate.GlobalNamingStrategy" init-method="init">
<property name="packagesToScan" value="com.daren.smallloan.**.entity"></property>
</bean>
</property>
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan" value="com.daren.smallloan.**.entity"/>
<property name="mappingLocations">
<list>
<value>classpath*:com/zhiwei/credit/model/**/*.hbm.xml</value>
<value>classpath*:com/credit/proj/hbms/*.hbm.xml</value>
<value>classpath*:sql-mapping/**/*.hbm.xml</value>
<value>classpath:jbpm.repository.hbm.xml</value>
<value>classpath:jbpm.execution.hbm.xml</value>
<value>classpath:jbpm.history.hbm.xml</value>
<value>classpath:jbpm.task.hbm.xml</value>
<value>classpath:jbpm.identity.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>