I have a requirement when I need to configure a Spring-based application to work with two databases. We have two databases that we use to store real-time data, and the other database is used as a data warehouse and contains archive data (which have an exact structure like Live db).
To keep it simple, suppose there is a search query for a product. What the application should do is search for product details in the Live database, and if it is not found, it will check the archive database.
If I need to configure this setting, I still need to tune to data sources and will the search code use the first data source to check the current database, and if it is not found, another query will be launched using the archive database?
The above is probably doable, but I'm wondering if there is a better way to do this. For example, is it possible to run an application on a single data source, although behind the scenes it actually works with two databases?
The application is based on Spring, JPA / Hibernate, SOAP and Mysql and Jboss 7 database as an application server.
Any examples showing how this is configured using Spring and Jboss will be very helpful.
thanks
ziggy source share