2 u011312056 u011312056 于 2013.07.09 17:37 提问

Spring OpenSessionInView没有起作用

我的项目采用Spring OpenSessionInView的事务控制方式,但是没有起作用,高手帮忙看看,谢谢啦~~

1个回答

u011312056
u011312056   2013.07.09 17:39
已采纳

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>
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!