-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: 2Databases mapping... Hurry Please!!!
PostPosted: Wed Jan 18, 2006 1:18 pm 
Newbie

Joined: Wed Jan 18, 2006 1:12 pm
Posts: 3
I need map two hibernate databases.. but if i put two callings of DB in the hibernate.cfg.xml, he donĀ“t works...
What can i do???

Onegaishimasu... Hayaku kudasai!!

_________________
Yoroshiku OnegaiShimasu Mina-san...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 18, 2006 1:24 pm 
Senior
Senior

Joined: Wed Aug 17, 2005 12:56 pm
Posts: 136
Location: Erie, PA (USA)
Multiple config files, multiple session factories, etc.
Curtis ...


Top
 Profile  
 
 Post subject: Hehehehehe
PostPosted: Wed Jan 18, 2006 1:30 pm 
Newbie

Joined: Wed Jan 18, 2006 1:12 pm
Posts: 3
I should do that... but i have milions of tables....

Is a admsys for a leasing company.... I have so much tables and if i duplicate all configs.... is spend time until death!!!

dont have another way kudasai???

_________________
Yoroshiku OnegaiShimasu Mina-san...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 18, 2006 1:45 pm 
Senior
Senior

Joined: Wed Aug 17, 2005 12:56 pm
Posts: 136
Location: Erie, PA (USA)
I assumed you wanted to make multiple entries for the same mapping -- in that case you need multiple session factories. You only need to duplicate the .cfg.xml file - one for each session factory. Then, you have to deal with building multiple session factories and retrieving sessions from the correct one, etc.

If you want to access multiple databases as if they were one db, I don't know how to handle that with Hibernate. You should probably be looking to solve the problem at the db level (aliases or other things to unify the databases).

Good luck,
Curtis ...


Top
 Profile  
 
 Post subject: Well
PostPosted: Wed Jan 18, 2006 1:55 pm 
Newbie

Joined: Wed Jan 18, 2006 1:12 pm
Posts: 3
The System solve the Session Factorys by himself... Is automatic in all terms... Cuz we need a pool conection and to much sessions in same time... I realy need a way to manipulate 2 Databases in same hibernate session... In the hibernte.cfg.xml, have i a way to duplicate the lines that call mysql and replace the names??? maybe calling another with another name and host?? can i do that???

_________________
Yoroshiku OnegaiShimasu Mina-san...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 18, 2006 3:18 pm 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
no, but you can change your Hibernate configuration dynamically.
use setProperty to provide the connection.
Still you will need two SessionFactories

Regards

Sebastian

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.