我在我的java项目中使用hibernate,但我正在使用的hibernate是遗留的一个意味着我正在使用的版本是hibernate 3而不是我正在使用Spring的hibernate,它是Spring专用的hibernate,
我正在通过网络找到关于p6SPY的信息。 jar中hibernate生成的查询,而不是问号,反映了实际的parmeter值,从开发人员的角度来看非常有用, 这是我经历过的链接
http://www.mkyong.com/hibernate/how-to-display-hibernate-sql-parameter-values-solution/
现在我想为我的应用程序提供相同的功能,但正如我之前告诉我的那样,我使用的是hibernate,而且我们的hibernate配置是在单个xml本身完成,如下所示,但请告知我如何配置在我的应用程序中我的hibernate xml的P6SPY的这种功能如下所示..
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING/DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans default-lazy-init="true" default-autowire="no">
<bean id="dataSource" class="com.persist.NullConnectionCheckerOracleDataSource" destroy-method="close">
<property name="user" value="GTO"/>
<property name="password" value=""/>
<property name="connectionCachingEnabled" value="true"/>
<!-- <property name="connectionCacheName" value="ia"/> -->
<property name="connectionCacheProperties">
<props>
<prop key="MaxLimit">20</prop>
<prop key="MinLimit">0</prop>
<prop key="InactivityTimeout">0 </prop>
<prop key="ConnectionWaitTimeout">60</prop>
<prop key="PropertyCheckInterval">60</prop>
<prop key="ValidateConnection">true</prop>
</props>
</property>
<property name="URL">
<value>jdbc:oracle:thin:@ldap://ccs.fm.ldap://ccsgcm.gcm.com:4042ldap://hkg0799xus.fm.</value>
</property>
<property name="connectionProperties">
<props>
<prop key="oracle.net.ldap_loadbalance">OFF</prop>
<prop key="v$session.osuser">@db.osuser@</prop>
<prop key="v$session.program">@db.program@</prop>
</props>
</property>
</bean>
<bean id="sessionFactoryTemplate" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="configurationClass" value="org.hibernate.cfg.Configuration"/>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
<prop key="hibernate.jdbc.batch_size">30</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.use_outer_join">false</prop>
<prop key="hibernate.max_fetch_depth">10</prop>
<prop key="hibernate.default_batch_fetch_size">150</prop>
<prop key="hibernate.bytecode.use_reflection_optimizer">true</prop>
<prop key="hibernate.connection.autoReconnect">true</prop>
<prop key="hibernate.connection.release_mode">on_close</prop>
<prop key="hibernate.cache.use_query_cache">false</prop>
<prop key="hibernate.cache.use_second_level_cache">false</prop>
<prop key="hibernate.cache.provider_configuration_file_resour ce_path">./config/ehcache-processor1/ehcache.xml</prop>
<prop key="hibernate.cache.use_structured_entries ">true</prop>
<prop key="hibernate.generate_statistics">true</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
</props>
</property>
</bean>
<bean id="txnManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="hibernateSession" class="com.persist.HibernateSessionImpl">
<constructor-arg><ref bean="sessionFactory"/></constructor-arg>
<property name="txnManager" ref="txnManager"/>
</bean>
<bean id="hibernateAdmin" class="com.persist.HibernateAdministrationImpl">
<constructor-arg><ref bean="sessionFactory"/></constructor-arg>
<constructor-arg><ref bean="&sessionFactory"/></constructor-arg>
</bean>
<bean id="systemProcessConfig" class="com.persist.SystemProcessConfiguration">
<constructor-arg index="0" value="gp"/>
<constructor-arg index="1" value="gp"/>
</bean>
</beans>
答案 0 :(得分:0)
首先,您需要使用最新版本的P6Spy。在以后的版本中有很多改进。顺便说一句 - 它已不再托管在SourceForge上。您可以从maven central获取最新版本。
要与Spring集成,请参阅this previously asked question的答案。