问题相关内容,在下面的链接里
http://cy.lzu.edu.cn/blog/article.php?tid=489
http://spring.jactiongroup.net/viewtopic.php?p=5791
http://www.javaeye.com/t/17339.html

简单来说,就是因为lazy的问题,采用了org.springframework.orm.hibernate3.support.OpenSessionInViewFilter,
但是这东东不太友好哦!

目前我的解决办法如下:
 spring原码不用改,
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter只管在web.xml文件里加载,不用带任何参数,
在业务层继承一个父类来管理事务:
一些关于hibernate 与 spring 事务管理的问题<?xml version="1.0" encoding="UTF-8"?>
一些关于hibernate 与 spring 事务管理的问题
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
一些关于hibernate 与 spring 事务管理的问题
<beans>
一些关于hibernate 与 spring 事务管理的问题    
<!--Base TransactionProxyed Service Bean-->
一些关于hibernate 与 spring 事务管理的问题    
<bean id="baseTxService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
一些关于hibernate 与 spring 事务管理的问题          abstract
="true">
一些关于hibernate 与 spring 事务管理的问题        
<property name="transactionManager" ref="transactionManager"/>
一些关于hibernate 与 spring 事务管理的问题        
<property name="proxyTargetClass" value="true"/>
一些关于hibernate 与 spring 事务管理的问题
一些关于hibernate 与 spring 事务管理的问题        
<property name="transactionAttributes">
一些关于hibernate 与 spring 事务管理的问题            
<props>
一些关于hibernate 与 spring 事务管理的问题                
<prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
一些关于hibernate 与 spring 事务管理的问题                
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
一些关于hibernate 与 spring 事务管理的问题                
<prop key="load*">PROPAGATION_REQUIRED,readOnly</prop>
一些关于hibernate 与 spring 事务管理的问题                
<prop key="save*">PROPAGATION_REQUIRED</prop>
一些关于hibernate 与 spring 事务管理的问题                
<prop key="update*">PROPAGATION_REQUIRED</prop>
一些关于hibernate 与 spring 事务管理的问题                
<prop key="remove*">PROPAGATION_REQUIRED</prop>
一些关于hibernate 与 spring 事务管理的问题                
<prop key="set*">PROPAGATION_REQUIRED</prop>
一些关于hibernate 与 spring 事务管理的问题                
<prop key="change*">PROPAGATION_REQUIRED</prop>
一些关于hibernate 与 spring 事务管理的问题                
<prop key="delete*">PROPAGATION_REQUIRED</prop>
一些关于hibernate 与 spring 事务管理的问题            
</props>
一些关于hibernate 与 spring 事务管理的问题        
</property>
一些关于hibernate 与 spring 事务管理的问题        
<property name="preInterceptors">
一些关于hibernate 与 spring 事务管理的问题            
<list>
一些关于hibernate 与 spring 事务管理的问题                
<ref bean="methodSecurityInterceptor"/>
一些关于hibernate 与 spring 事务管理的问题            
</list>
一些关于hibernate 与 spring 事务管理的问题        
</property>
一些关于hibernate 与 spring 事务管理的问题    
</bean>
一些关于hibernate 与 spring 事务管理的问题
</beans>

一些关于hibernate 与 spring 事务管理的问题    <bean id="infopathManager" parent="baseTxService" autowire="byName">
一些关于hibernate 与 spring 事务管理的问题        
<property name="target">
一些关于hibernate 与 spring 事务管理的问题            
<bean class="com.gdlinkway.ebop.infopath.manager.InfopathManager"/>
一些关于hibernate 与 spring 事务管理的问题        
</property>
一些关于hibernate 与 spring 事务管理的问题    
</bean>

业务层的方法名的前面关键字,自己加上去。
就这样子。

相关文章: