Multiple Databases Configuration
Hi there,
I'm new with spring/hibernate and I'm starting a new project using those 2 great technologies.
My project is a bit complicated as it uses 2 (actually 3) database connections...
1 - Read only - localhost
2 - Update - Company's server in House
3 - Pending Queries System - this is an extra db to make sure we never loose info between 1 and 2. So if the company's internet is down we don't have any loss of data as they are always "cached" in this numero 3 db.
Anyway I m not here to talk about my architecture that I won't really be able to change, but to know HOW to do it with Spring/Hibernate.
I already create severals SessionFactories, DataSources, and transactionManagers.
apparently i have to use aop but i m not really sure if it is the best way
This is my config for aop
Code:
<aop:config>
<aop:pointcut id="defaultServiceOperation"
expression="execution(* com.companyname.dao.*Impl.*(..))" />
<aop:advisor pointcut-ref="defaultServiceOperation"
advice-ref="defaultTxAdvice" />
<!--
<aop:pointcut id="noTxServiceOperation" expression="execution(*
com.companyname.dao.*DF.*(..))" />
<aop:advisor pointcut-ref="noTxServiceOperation"
advice-ref="noTxAdvice" />
-->
</aop:config>
<!-- ADVICE -->
<tx:advice id="defaultTxAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="get*" read-only="true" />
<tx:method name="*" />
</tx:attributes>
</tx:advice>
<tx:advice id="noTxAdvice" transaction-manager="noTxManager">
<tx:attributes>
<tx:method name="*" propagation="NEVER" />
</tx:attributes>
</tx:advice>
Could anyone just help me first to make a project with 2 databases Slave/Master like?
Or does anyone has any ideas how to do my 3 db project?