一夕JZ 2013-07-09 09:37 采纳率: 50%
浏览 2581
已采纳

Spring OpenSessionInView没有起作用

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

  • 写回答

1条回答 默认 最新

  • 一夕JZ 2013-07-09 09: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>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序