程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> opensessioninview-Spring OpenSessionInView沒有起作用

opensessioninview-Spring OpenSessionInView沒有起作用

編輯:編程綜合問答
Spring OpenSessionInView沒有起作用

我的項目采用Spring OpenSessionInView的事務控制方式,但是沒有起作用,高手幫忙看看,謝謝啦~~

最佳回答:


web.xml:

hibernateFilter
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter

singleSession
true



hibernateFilter
.

Spring配置:

<bean id="propertyConfig"
    class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="location">
        <value>classpath:config/jdbc.properties</value>
    </property>
</bean>
<bean id="dataSourceOracle" class="com.jolbox.bonecp.BoneCPDataSource"
    destroy-method="close">
    <property name="driverClass" value="${jdbc.driver}" />
    <property name="jdbcUrl" value="${jdbc.url}" />
    <property name="username" value="${jdbc.user}" />
    <property name="password" value="${jdbc.password}" />
    <property name="idleConnectionTestPeriod" value="60" />
    <property name="idleMaxAge" value="240" />
    <property name="maxConnectionsPerPartition" value="6" />
    <property name="minConnectionsPerPartition" value="2" />
    <property name="partitionCount" value="1" />
    <property name="acquireIncrement" value="5" />
    <property name="statementsCacheSize" value="100" />
    <property name="releaseHelperThreads" value="3" />
</bean>

class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
value="classpath:hibernate.cfg.xml">

 <bean id="parentDao" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <description>All Dao bean's parent bean, define the common sessionFactory property of Dao implements classes  </description>
    <property name="sessionFactory" ref="sessionFactory" />     
</bean>

<bean id="transactionProxy" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> 
    <property name="transactionManager" ref="parentDao"></property>
    <property name="transactionAttributes"> 
        <props>
            <prop key="*">PROPAGATION_REQUIRED</prop> 
        </props> 
    </property> 
</bean>
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved