I am working on a project where we each service refers four separate data-source. Until now, we have been using ProxyFactoryBean to refer to the Dao target and the Transaction Intereceptor - something like this..
<bean id="readOnlyUserProxy" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="target" ref="readOnlyDao"/>
<property name="interceptorNames">
<list>
<value>readOnlyTransactionInterceptor</value>
</list>
</property>
</bean>
There are 3 other similar proxies for the different DAOs . All these refer to different transaction interceptors which in turn connect to different transaction managers. In short, each service connects to 4 dao proxies each of which refer a separate transaction interceptor, each of which in turn refer to a separate transaction manager connecting to 4 different data sources. All work fine till now with lazy="false".
Now, In order to optimize the performance, we wish to enable 'Lazy loading' and carry the hibernate session to the handler layer. We think that the best way for this would be through the 'TransactionProxyFactoryBean' as we do not want to use the OpenSessionInView approach .
We have tried some approaches but are stuck because we connect to 4 separate data sources through each service and in now way can we connect the four separate transaction managers to the 'TransactionProxyFactoryBean'. Therefore, we are not able to find a way to manage the transactions from different data sources in the handler/service layer.
I have just started on this work and do not have much experience in Spring transaction management. Kindly guide me on any possible approach I could take.