-->
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.  [ 2 posts ] 
Author Message
 Post subject: Specifying more then 2 URLs in a single hbm.xml file!
PostPosted: Fri May 12, 2006 2:17 pm 
Newbie

Joined: Fri Apr 07, 2006 3:43 pm
Posts: 14
Guys,

Is it possible to specify more then one datasource in a single hibernate.cfg.xml file? if so how???


Example would be appreciated


Thx


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 12, 2006 4:21 pm 
Newbie

Joined: Fri Nov 04, 2005 11:37 am
Posts: 6
Hi There,

Not sure if you can do it with hibernate.cfg.xml but surly in your hibernate utility class while creating sessionfactory, something like below


Code:
Configuration configuration = new Configuration();
configuration.setProperty( "hibernate.connection.datasource", "java:/jdbc/" + dsName );

sessionFactory = configuration.configure( new File( configFile ) )                    .buildSessionFactory();
hmSessionFactory.put(dsName,sessionFactory);
.....
....


you will have to maintain hashmap of sessionfactory that will have key as dsname and value of respective session factory.

just wondering what exactly is your requirement.


-Praful


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