首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2EE开发 >

Annotation进行声明式事务管理不能获得session,麻烦了解决方法

2012-04-21 
Annotation进行声明式事务管理不能获得session,麻烦了相关配置:tx:advice idtxAdvice transaction-man

Annotation进行声明式事务管理不能获得session,麻烦了
相关配置:
<tx:advice id="txAdvice" transaction-manager="myTxManager"> 
<tx:attributes> 
<tx:method name="increasePrice*" propagation="REQUIRED"/> 
<tx:method name="someOtherBusinessMethod" propagation="REQUIRES_NEW"/> 
<tx:method name="*" propagation="SUPPORTS" read-only="true"/> 
</tx:attributes> 
</tx:advice>
<bean id="myTxManager" 
class="org.springframework.orm.hibernate4.HibernateTransactionManager"> 
<property name="sessionFactory" ref="sessionFactory"/> 
</bean>

具体的应用是在service层相关方法上加@Transactional注解。
在dao层用sessionfaction.getCurrentSession()获得session完成后即操作,

在运行时却报了nosession的错误,没有其他任何错误。麻烦各位了,谢谢………………
才用的是spring3&hibernate4


[解决办法]
sessionFactory 是要注入了没?

热点排行