I have on e service FeedbackService. I have defined a pointcut on all methods of this service. this pointcut referes to a transaction advice (txAdvice) which points to DB1.
2) I also have a mantisFeedbackDAO defined in FeedbackService which has a sessionfactory pointing to DB2.
Please find my configuration as follows :
As I said above in point no. 2 "mantisSessionFactory" is pointing to DB2.Code:<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <tx:advice id="txAdvice" transaction-manager="txManager"> <tx:attributes> <tx:method name="*" propagation="REQUIRED" /> <tx:method name="get*" propagation="SUPPORTS" read-only="true" /> <tx:method name="count*" propagation="SUPPORTS" read-only="true" /> <tx:method name="validate*" propagation="SUPPORTS" read-only="true" /> <tx:method name="find*" propagation="SUPPORTS" read-only="true" /> <tx:method name="login" propagation="SUPPORTS" read-only="true" /> </tx:attributes> </tx:advice> <aop:pointcut id="serviceOperationMantis" expression="execution(* com.cmt.common.service.FeedbackService.*(..))" /> <aop:advisor advice-ref="txAdvice" pointcut-ref="serviceOperationMantis" /> <bean name="feedbackService" class="com.cmt.common.service.FeedbackService" scope="singleton"> <property name="mantisFeedbackDAO"> <ref bean="mantisFeedbackDAO"/> </property> </bean> <bean id="mantisFeedbackDAO" class="com.cmt.common.dao.MantisFeedbackDAO" scope="singleton"> <property name="sessionFactory"> <ref bean="mantisSessionFactory" /> </property> </bean>
Now when I call any method in feedbackService it will start the transaction using transaction manager - "txManager". But when I give call to a method in mantisFeedbackDAO through feedbackservice,it is performing operations on DB2. So how does this work?? Because when we threw a RuntimeException from this DAO method Spring didn't roll-back the transaction.
Does this kind of configuration make any sense as far as Spring's Transaction Management is concerned??


Reply With Quote