-->
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.  [ 5 posts ] 
Author Message
 Post subject: Multiple Datasources and Hibernate configuration
PostPosted: Tue Jun 21, 2005 7:08 am 
Newbie

Joined: Tue Jun 21, 2005 6:32 am
Posts: 1
Hibernate version:2.1

Mapping documents:hibernate.cfg.xml

Code between sessionFactory.openSession() and session.close():


Name and version of the database you are using:SQL Database 2000

Please provide me with the example if you have any for using multiple datasources.

In some sites ,it is stating that you have to make multiple configuration file and multiple session factories.

and in this hibernate.org , i found that we can add multiple entries for session-factory ,but then how do i use that?

Please reply me ASAP.

Thanks in advance,
Soneey


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 18, 2005 4:41 pm 
Beginner
Beginner

Joined: Thu May 26, 2005 12:31 pm
Posts: 25
you have to use multiple configuration files.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 08, 2005 10:49 am 
Newbie

Joined: Mon Oct 31, 2005 2:35 pm
Posts: 4
Ok, but why? Why not modify the DTD so that we can have multiple session factories? Make a rule that session-factorys' name attributes must be present and unique when specifying more than one session-factory element. Then, when parsing the config file, just iterate the session-factory elements and put them in a map keyed by the name attribute. Then all you need is a buildSessionFactory(String name) method. Looks easy enough to me. Why make the developer do extra work of creating and maintaining multiple config files?

- MM


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 08, 2005 10:56 am 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
Quote:
Why make the developer do extra work of creating and maintaining multiple config files?


you make it sound so painful to copy/paste a 1kb file. you can always modify the source and submit a patch :)

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 08, 2005 11:21 am 
Newbie

Joined: Mon Oct 31, 2005 2:35 pm
Posts: 4
kochcp wrote:
you make it sound so painful to copy/paste a 1kb file. you can always modify the source and submit a patch :)


True, but it seems to me more logical to have all the session factories specified in one config file. And yes, i will submit a patch. Thanks. :)

- MM


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.