Someone know how to add a another datasource in hibernate configuration and how to configure Spring to that datasource its autoinject in my respective DAO?
This is m
I had the same problem. I solved it like this:
First of all, there should be different cfg.xml files for different databases. Then simply use Configuration object of the Hibernate whenever you want to connect to your second database.
Configuration config = new Configuration().configure("");
SessionFactory sessionFactory = config.buildSessionFactory();
Session session = sessionFactory.getCurrentSession();
session.beginTransaction();
I found this here : http://www.coderanch.com/t/468821/ORM/java/If-hibernate-cfg-xml-has
I am pretty sure that this can be extended to more than 2 databases. Hope this helps.