Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-07-2007, 06:23 AM
Member
 
Join Date: May 2007
Posts: 38
Marty is on a distinguished road
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
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-07-2007, 08:06 AM
Senior Member
 
Join Date: Mar 2007
Posts: 136
goldhouse is on a distinguished road
Hibernate has a configuration file called hibernate.properties or hibernate.cfg.xml. There you can specify the properties of database like
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
By default if you download the hibernate source , it will working on hsqldb.
I have tried hibernate in oracle, mysql, hsqldb
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 05-07-2007, 06:56 PM
Member
 
Join Date: Apr 2007
Location: Indiana
Posts: 84
pegitha is on a distinguished road
Send a message via Skype™ to pegitha
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();
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hibernate with multiple databases dsr0781 Database 5 06-23-2008 03:06 PM
Database connectivity in Jave struts with Hibernate sanjay_sharma77 Advanced Java 1 02-02-2008 10:41 PM
How can I store an image to the database using hibernate cryss_tyna Database 0 08-15-2007 03:48 PM
Hibernate 2.1.8 / Oracle 10 / Tomcat 5.0.28 : Data not retrieved from the database scastro Database 4 08-10-2007 12:41 AM
org.hibernate.ejb.Version <clinit> INFO: Hibernate EntityManager 3.2.0.CR1 Heather Database 2 06-30-2007 05:01 PM


All times are GMT +3. The time now is 02:02 AM.


VBulletin, Copyright Đ2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright Đ2006 - 2007, www.java-forums.org