hibernate log4j 输出sql
applicationContext.xml
<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.Oracle9Dialect
</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/bbp/wage/model/BbpClerk.hbm.xml</value>
<value>com/bbp/wage/model/BbpDept.hbm.xml</value>
<value>com/bbp/wage/model/BbpPermit.hbm.xml</value>
<value>com/bbp/wage/model/BbpPermitAlloc.hbm.xml</value>
<value>com/bbp/wage/model/BbpRole.hbm.xml</value>
<value>com/bbp/wage/model/BbpRoleAlloc.hbm.xml</value>
<value>com/bbp/wage/model/BbpTaxRatio.hbm.xml</value>
<value>com/bbp/wage/model/BbpWageConst.hbm.xml</value>
<value>com/bbp/wage/model/BbpWageItem.hbm.xml</value>
<value>
com/bbp/wage/model/BbpWageItemAlloc.hbm.xml
</value>
<value>com/bbp/wage/model/BbpWageItemval.hbm.xml</value>
<value>com/bbp/wage/model/BbpWageJournal.hbm.xml</value>
<value>
com/bbp/wage/model/BbpWageJrnlEntry.hbm.xml
</value>
<value>com/bbp/wage/model/BbpWageLevel.hbm.xml</value>
<value>com/bbp/wage/model/BbpWagePayment.hbm.xml</value>
<value>com/bbp/wage/model/BbpWageTable.hbm.xml</value>
<value>com/bbp/wage/model/BbpWageItemsum.hbm.xml</value>
<!-- reim -->
<value>
com/bbp/reim/model/BbpReimLevbudget.hbm.xml</value>
<value>
com/bbp/reim/model/BbpReimLevbudgetRef.hbm.xml</value>
<value>
com/bbp/reim/model/BbpReimActivity.hbm.xml
</value>
<value>com/bbp/reim/model/BbpReimAdvance.hbm.xml</value>
<value>com/bbp/reim/model/BbpReimApprv.hbm.xml</value>
<value>com/bbp/reim/model/BbpReimFee.hbm.xml</value>
<value>
com/bbp/reim/model/BbpReimFeeDetail.hbm.xml
</value>
<value>com/bbp/reim/model/BbpReimFeeitem.hbm.xml</value>
<value>com/bbp/reim/model/BbpReimJournal.hbm.xml</value>
<value>
com/bbp/reim/model/BbpReimJournalEntry.hbm.xml
</value>
<value>com/bbp/reim/model/BbpReimReceipt.hbm.xml</value>
<value>com/bbp/reim/model/BbpReimRetadv.hbm.xml</value>
<value>com/bbp/reim/model/BbpReimRole.hbm.xml</value>
<value>
com/bbp/reim/model/BbpReimRoleAlloc.hbm.xml
</value>
<value>com/bbp/reim/model/BbpReimWfAlloc.hbm.xml</value>
<value>
com/bbp/reim/model/BbpReimWorkflow.hbm.xml
</value>
<value>com/bbp/voucher/model/BbpVoucher.hbm.xml</value>
<value>
com/bbp/voucher/model/BbpVoucherAccountinfo.hbm.xml
</value>
<value>
com/bbp/voucher/model/BbpVoucherAdditionalinfo.hbm.xml
</value>
<value>
com/bbp/voucher/model/BbpVoucherDetail.hbm.xml
</value>
<value>com/bbp/reim/model/BbpReimOutBank.hbm.xml</value>
</list>
</property>
</bean>
------解决思路---------------------- log4j.properties
#log4j.rootLogger=debug, stdout log4j.logger.net.sf.hibernate=warn ### log just the SQL log4j.logger.net.sf.hibernate.SQL=debug ### log JDBC bind parameters ### log4j.logger.net.sf.hibernate.type=info ### log schema export/update ### log4j.logger.net.sf.hibernate.tool.hbm2ddl=debug ### log cache activity ### #log4j.logger.net.sf.hibernate.cache=debug
------解决思路---------------------- spring 的配置文件中:applicationContext.xml <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref local="dataSource" /> </property> <property name="mappingResources"> <list> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> org.hibernate.dialect.Oracle9Dialect </prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.format_sql">true</prop> <prop key="hibernate.cache.use_second_level_cache"> true </prop> <prop key="hibernate.cache.use_query_cache">true</prop> <prop key="hibernate.cache.provider_class"> org.hibernate.cache.EhCacheProvider </prop> <prop key="net.sf.ehcache.configurationResourceName"> classpath:com/config/ehcache.xml </prop> </props> </property> </bean>
http://www.myexception.cn/java-web/173526.html
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。