Results 1 to 4 of 4
Thread: Hibernate with multiple database
- 05-07-2007, 04:23 AM #1
Member
- Join Date
- May 2007
- Posts
- 38
- Rep Power
- 0
Hibernate with multiple database
Hello people
Does anybody use hibernate to access to a multiple database?
I searched in internet but I don´t understand and the documentation of hibernate says:
How do I use multiple databases?
You must configure multiple SessionFactory instances.
If you have more information, please tell me
Marty
- 05-07-2007, 06:06 AM #2
Senior Member
- Join Date
- Mar 2007
- Posts
- 134
- Rep Power
- 0
Hibernate has a configuration file called hibernate.properties or hibernate.cfg.xml. There you can specify the properties of database like
By default if you download the hibernate source , it will working on hsqldb.Java Code:hibernate.connection.driver_class jdbc driver class hibernate.connection.url jdbc URL hibernate.connection.username database user hibernate.connection.password database user password hibernate.connection.pool_size maximum number of pooled connections
I have tried hibernate in oracle, mysql, hsqldb
- 05-07-2007, 04:56 PM #3
Member
- Join Date
- Apr 2007
- Location
- Indiana
- Posts
- 83
- Rep Power
- 0
I have used Hibernate with two databases. You just need to make two datasources then call the one you need for the specific query. I have most recently been using hibernate with Spring but I looked up some old code and what I did was made two different SessionFactories, and so I would call either one or the other session from the factory.
session = DBUtil.getABCSession();
or
session = DBUtil.getDEFSession();
- 12-23-2008, 12:57 PM #4
Member
- Join Date
- Dec 2008
- Posts
- 1
- Rep Power
- 0
Similar Threads
-
Hibernate with multiple databases
By dsr0781 in forum JDBCReplies: 5Last Post: 06-23-2008, 01:06 PM -
Database connectivity in Jave struts with Hibernate
By sanjay_sharma77 in forum Advanced JavaReplies: 1Last Post: 02-02-2008, 08:41 PM -
How can I store an image to the database using hibernate
By cryss_tyna in forum JDBCReplies: 0Last Post: 08-15-2007, 01:48 PM -
Hibernate 2.1.8 / Oracle 10 / Tomcat 5.0.28 : Data not retrieved from the database
By scastro in forum JDBCReplies: 4Last Post: 08-09-2007, 10:41 PM -
org.hibernate.ejb.Version <clinit> INFO: Hibernate EntityManager 3.2.0.CR1
By Heather in forum JDBCReplies: 2Last Post: 06-30-2007, 03:01 PM


LinkBack URL
About LinkBacks

Bookmarks