-->
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: hibernate.cfg.xml and mapping locations
PostPosted: Sun Dec 25, 2005 8:16 pm 
Newbie

Joined: Sun Dec 25, 2005 8:07 pm
Posts: 4
I am building a web app that uses hibernate.
I would like to place my hibernate.cfg.xml file in the WEB-INF/ directory, and all of my mapping files in a subdirectory, namely WEB-INF/hibernate/.

I have tried many things to achieve this and grep'ed the forums, googled it, and can not find an answer.

I want to do something like the following:
configuration.configure("WEB-INF/hibernate.cfg.xml");


then, in my hibernate.cfg.xml file,
<mapping resource="WEB-INF/hibernate/user.hbm.xml"/>
<mapping resource="WEB-INF/hibernate/settings.hbm.xml"/>


Has anyone done this, or am I forced to put the mapping files in WEB-INF/classes and use the class mapping:
<mapping class="com.beaglebuddy.Settings"/>

Thanks for any help


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 26, 2005 9:07 am 
Regular
Regular

Joined: Mon Aug 29, 2005 9:46 am
Posts: 102
I believe you have to put the files in your root directory, which is, your classes directory.

C ya

_________________
Don't forget to rate if the post helped!


Top
 Profile  
 
 Post subject: really?
PostPosted: Tue Dec 27, 2005 2:13 pm 
Newbie

Joined: Sun Dec 25, 2005 8:07 pm
Posts: 4
There's really no way to do this in hibernate?

There's no way to tell hibernate to read mapping files from a directory in your war file? It seems that since most apps are web based these days, that hibernate would have some way of doing this.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 27, 2005 2:24 pm 
Regular
Regular

Joined: Fri Sep 09, 2005 11:35 am
Posts: 101
Hibernate will read mapping files from the classpath so you can have a separate hibernate directory in WEB-INF/classes dir.

If you really want to use the WEB-INF/hibernate dir, you can read the mapping files yourself and add them to Configuration object. See the docs for org.hibernate.cfg.Configuration class.


Top
 Profile  
 
 Post subject: ok
PostPosted: Tue Dec 27, 2005 7:17 pm 
Newbie

Joined: Sun Dec 25, 2005 8:07 pm
Posts: 4
yeah, I could extend the Configure class and add the functionality in.
I just thought Hibernate might already have that built in, and I was just not doing it right.

It's way more convenient for me to have them all together in a single directory than scattered about on the classpath. That's just my personal opinion, what works best for me.

Thanks for the help everyone.


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.