I am developing a project using Hibernate and the requirement is to connect to two different Databases
1. ORacle and
2. SQL Server.
The same set of tables exist in both the tables.(i.e. name of Tables and their fields are same in both the databases).
Both the databases need to be accessed during the life cycle of request from user.
How I can I achieve this using Hibernate ?
I have read few blogs on web, some speaks:
- by making two different hibernate.cfg.xml file and having two SessionFactory Instances.
- Somewhere I can see as Using JTA.
- Some says using ThreadLocal .
But I don't get any stepwise example of codes for any of above approaches.
Can someone plesae help me to point to such step by step solution from where I can get this solved with better understanding of these approaches.
The more descriptive will be more appreciated as I am not expert in Hibernate