File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Configuring Hibernate with two databases Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Configuring Hibernate with two databases" Watch "Configuring Hibernate with two databases" New topic

Configuring Hibernate with two databases

Renjith Mohan
Ranch Hand

Joined: Nov 28, 2008
Posts: 65

I am developing one Swing application where I need to integrate hibernate. The application has to connect to two databases. Since I am a novice in hibernate, I googled and came to know 2 configuration files are required to accomplish this. As per that I have two sets of:
1. hibernate.cfg.xml and

I created one HibernateUtil class also. But my doubt is how can I get session factory instance of each database?
Also since this is desktop application, so there is no need for pool of connection, what is the configuration in hibernate for that ? (Normally, in most of the sites, I found hibernate configuration files with datasource mapping.)

Please help me

Thanks in advance
I agree. Here's the link:
subject: Configuring Hibernate with two databases
It's not a secret anymore!