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.  [ 4 posts ] 
Author Message
 Post subject: *.hbm.xml without embedding
PostPosted: Fri Sep 29, 2006 6:47 am 
Newbie

Joined: Fri Sep 29, 2006 4:54 am
Posts: 6
Hello,

I have a simple question: is it possible to use external *.hbm.xml files that are not embedded at compile time?

The documentation (here) seems to imply that it's possible, but I can't make it work.

_________________
Age is a question of mind over matter. If you don't mind, then it doesn't matter.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 29, 2006 7:22 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Yes, it is possible. Use Configuration.AddXmlFile(filename) to add the mapping files one-by-one, or use AddDirectory to add all .hbm.xml files in a directory.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 29, 2006 7:40 am 
Newbie

Joined: Fri Sep 29, 2006 4:54 am
Posts: 6
Thanks for your quick reply. That is indeed one solution. However, that still implies I have to foresee at compile time where these files will be located. Is there an out-of-the-box way to configure this.

I could of course define the location of this hbm directory in my app.config file.

_________________
Age is a question of mind over matter. If you don't mind, then it doesn't matter.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 29, 2006 9:46 am 
Regular
Regular

Joined: Tue May 31, 2005 3:18 pm
Posts: 117
Location: Houston
yeah in your app/web.config, put in a key like this:

Code:
<appSettings>
   <add key="mappingDir" value="../../mappings/" />
</appSettings>


then in your session factory initialization routine, do this:
Code:
string mappingDir = ConfigurationManager.AppSettings["mappingDir"];
config.AddDirectory(mappingDir);


HTH.

_________________
------------------------------
Ben Scheirman
http://www.flux88.com


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