大家来看看这么配置SPRING事物对吗?(多service)

hardways 2007-11-27 03:23:42
分别有两中不用业务,相互无关,我为每个业务配置了事物,这样可以吗?会不会有冲突?


<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>

<!--业务1-->
<bean id="TransactionProxyFactoryBean1" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="target">
<ref bean="publicSurveyService"/>
</property>

<property name="transactionAttributes">
<props>
<prop key="*"> PROPAGATION_REQUIRED </prop>
</props>
</property>
</bean>

<bean id="publicSurveyService" parent="TransactionProxyFactoryBean1">
<property name="target">
<bean class="com.gmodel.service.publicsurvey.PublicSurveyServiceImp">
<property name="publicSurveyDAO"> <ref bean="publicSurveyDAO"/> </property>
</bean>
</property>
</bean>
<!--结束业务1-->

<!--业务2-->
<bean id="TransactionProxyFactoryBean2" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="target">
<ref bean="bigPicService"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="*"> PROPAGATION_REQUIRED </prop>
</props>
</property>
</bean>


<bean id="bigPicService" parent="TransactionProxyFactoryBean2">
<property name="target">
<bean class="com.bmodel.service.bigpic.BigPicServiceImp">
<property name="bigPicDAO"> <ref bean="bigPicDAO"/> </property>
</bean>
</property>
</bean>
<!--结束业务2-->
...全文
83 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
hardways 2007-11-28
  • 打赏
  • 举报
回复
顶!
hardways 2007-11-27
  • 打赏
  • 举报
回复
顶!

81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧