-->
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.  [ 3 posts ] 
Author Message
 Post subject: Multiple Session Factories
PostPosted: Thu Apr 28, 2005 4:40 pm 
Newbie

Joined: Tue Nov 23, 2004 12:24 pm
Posts: 7
Location: Washington, DC
I have an application that gets data from multiple databases. All databases have the same schema.
I use multiple SessionFactories to query the data.
There are over 50 database partitions, so I had to use 50 configuration files to get it working.

I would rather have one file, that has multiple session factories. Is this possible?

I have read the documentation and many of the discussions in this forum, but I have yet to find an answer..

Is it possible to configure multiple session factories in one configuration file?

I would really appreciate if anyone can answer that.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 29, 2005 4:32 am 
Regular
Regular

Joined: Wed Feb 02, 2005 6:33 am
Posts: 70
If all databases have the same schema, then the only thing changing is your datasource? If so, why not load the configuration file into a DOM tree, and manipulate that for creating the session factories as required? For that matter, I guess it'd be possible to parse a custom xml document containing a set of configurations, taking each configuration and creating a session factory from it.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 29, 2005 8:55 am 
Senior
Senior

Joined: Mon Apr 04, 2005 8:04 am
Posts: 128
Location: Manchester, NH USA
Alternatively you could build the Hibernate Configuration object programmatically using the Configuration API. This is fairly trivial in most instances.


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