-->
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: How to include a cfg.xml into the hibernate.cfg.xml
PostPosted: Thu Jan 08, 2009 10:33 am 
Newbie

Joined: Thu Jan 08, 2009 10:29 am
Posts: 3
Hi what I've a modular application, and I wanna to include the moduleA-hibernate.cfg.xml into the main hibernate.cgf.xml, how can I do that?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 08, 2009 10:40 am 
Regular
Regular

Joined: Wed Oct 15, 2008 6:59 am
Posts: 103
Location: Chennai
u can't add hibernate.cfg.xml to another hibernate.cfg.xml file. to tackle this problem,

getConfiguration() from current SessionFactory and change as u like and rebuild by code.. that's a solution

for eg.,

Configuration cfg = new Configuration()
.addResource("Item.hbm.xml")
.addResource("Bid.hbm.xml");

_________________
If u feel it will help you, don't forget to rate me....


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 09, 2009 8:53 am 
Newbie

Joined: Thu Jan 08, 2009 10:29 am
Posts: 3
Ok, just one more question, there is a way to get the configuration from my SessionFactory. Because I'm using the hibernate.cfg.xml, that have all the basic configuration, and what I have to do to put the other's mapping was this:

Code:
configuration = new Configuration();
configuration.configure("hibernate.cfg.xml");


I do that because I've some dependence in the tables. And after thatI've add the resourses, but I see in the log that there is no SessionFactory selected, the message on the log was:

INFO Configuration:1419 - Configured SessionFactory: null

And after this message the tables are map.

So waht I really wanna do is get the configuration from my current SessionFactory (that have all the mapping from my cfg), so I can just add my others resources without havengi to reload all the hibernate config.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 09, 2009 10:12 am 
Regular
Regular

Joined: Wed Oct 15, 2008 6:59 am
Posts: 103
Location: Chennai
first build sessionFactory from Configuration Object. whenever u r going to add new resources, add it to that configuration and then rebuild sessionFactory.

i already searched for getting configuration object from sessionFactory, no use. thatz why i use procedure in my testing.

_________________
If u feel it will help you, don't forget to rate me....


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 09, 2009 12:21 pm 
Newbie

Joined: Thu Jan 08, 2009 10:29 am
Posts: 3
Ok thanks.


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.