SSH整合后console显示sql语句

在applicationContext.xml中配置
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "
http://www.springframework.org/dtd/spring-beans.dtd ">
<beans>
 <bean id="palceHolderConfig"
  class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
  abstract="false" singleton="true" lazy-init="default"
  autowire="default" dependency-check="default">
  <property name="location">
   <value>classpath:init.properties</value>
  </property>
 </bean>
 <!--c3p0数据源配置-->
 <bean id="dataSource"
  class="com.mchange.v2.c3p0.ComboPooledDataSource"  destroy-method="close" dependency-check="default">
  <property name="driverClass">
   <value>${dataSource.driver}</value>
  </property>
  <property name="jdbcUrl">
   <value>${dataSource.jdbcUrl}</value>
  </property>
  <property name="user">
   <value>${dataSource.user}</value>
  </property>
  <property name="password">
   <value>${dataSource.password}</value>
  </property>
  
  <property name="acquireIncrement">
   <value>${dataSource.acquireIncrement}</value>
  </property>
  <property name="minPoolSize">
   <value>${dataSource.minPoolSize}</value>
  </property>
  <property name="maxPoolSize">
   <value>${dataSource.maxPoolSize}</value>
  </property>
  <property name="maxIdleTime">
   <value>${dataSource.maxIdleTime}</value>
  </property>
  <property name="idleConnectionTestPeriod">
   <value>${dataSource.idleConnectionTestPeriod}</value>
  </property>
 
  
 </bean>
 <bean id="sessionFactory"
  class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
  <property name="dataSource">
   <ref bean="dataSource" />
  </property>
  <property name="hibernateProperties">
   <props>
    <prop key="hibernate.dialect">
     org.hibernate.dialect.MySQLDialect
    </prop>
    <!-- 显示sql语句 -->
    <prop key="hibernate.show_sql">true</prop>

   </props>

  </property>
  <property name="mappingResources">
   <list>
    <value>com/vo/Customer.hbm.xml</value>
    <value>com/vo/Engineer.hbm.xml</value>
    <value>com/vo/Repairplant.hbm.xml</value>
    <value>com/vo/Product.hbm.xml</value>
    <value>com/vo/Archives.hbm.xml</value>
    <value>com/vo/Account.hbm.xml</value>
    <value>com/vo/User.hbm.xml</value></list>
  </property>
  
  </bean>
 <bean id="engineerDAO" class="com.dao.impl.EngineerDAO">
  <property name="sessionFactory">
   <ref bean="sessionFactory" />
  </property>
 </bean>
 <bean id="repairplantDAO" class="com.dao.impl.RepairplantDAO">
  <property name="sessionFactory">
   <ref bean="sessionFactory" />
  </property>
 </bean>
 <bean id="productDAO" class="com.dao.impl.ProductDAO">
  <property name="sessionFactory">
   <ref bean="sessionFactory" />
  </property>
 </bean>
 <bean id="archivesDAO" class="com.dao.impl.ArchivesDAO">
  <property name="sessionFactory">
   <ref bean="sessionFactory" />
  </property>
 </bean>
 <bean id="accountDAO" class="com.dao.impl.AccountDAO">
  <property name="sessionFactory">
   <ref bean="sessionFactory" />
  </property>
 </bean>
 <bean id="userDAO" class="com.dao.impl.UserDAO">
  <property name="sessionFactory">
   <ref bean="sessionFactory" />
  </property>
 </bean>
 
 <bean id="customerDAO" class="com.dao.impl.CustomerDAO">
  <property name="sessionFactory">
   <ref bean="sessionFactory" />
  </property>
 </bean>
 
 </beans>
这样就可以在调试的时候显示sql语句了.

你可能感兴趣的:(sql,bean,user,ssh,Class,encoding)