-->
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: How to use more than one config file?
PostPosted: Fri Aug 31, 2007 11:02 am 
Beginner
Beginner

Joined: Fri Apr 13, 2007 9:27 am
Posts: 33
Hello all:

How can I configer the session factory to use more than one config file?

I have two modules that uses Hibernate. Each module has its own config file. The two module works fine independent from each other. I want to combine to use the two module in a project.

I created a jar file for each module and dropped them in the project class path. It doesn't work, because the session factory load one config file only.

my SessionFactory class use looks like that:

sessionFactory = new Configuration().configure.buildSessionFactory();

I modified to look like that:

sessionFactory = new Configuration().addJar(new File("First.jar")).addJar(new File ("Second.jar")).buildSessionFactory();

and still doesn't work.

Any help is greatly appreciated.


Top
 Profile  
 
 Post subject: Re: How to use more than one config file?
PostPosted: Fri Aug 31, 2007 1:28 pm 
Beginner
Beginner

Joined: Tue Oct 10, 2006 3:23 am
Posts: 33
I'm not sure what you are trying to achieve but I know that this works:

conf= new AnnotationConfiguration().configure("hibernate.cfg.xml");
conf.addResource("orm.xml");

Where I split the conf part from the entity definition.

Otherwise I think that you can do it manually ie conf.addProperty or something


* rate if this helps *


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.