-->
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.  [ 6 posts ] 
Author Message
 Post subject: Do I need to specify every mapping file?
PostPosted: Thu Oct 07, 2004 4:50 pm 
Regular
Regular

Joined: Thu Oct 07, 2004 4:45 pm
Posts: 92
Hi.

Is there anyway to avoid having to specify every Hibernate mapping file (or class) when configuring the SessionFactory? Is there any way to get Hibernate to automatically "discover" what mappings exist? If not, can they all be put into one file?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 10, 2004 3:42 pm 
Expert
Expert

Joined: Thu Jan 29, 2004 2:31 am
Posts: 362
Location: Switzerland, Bern
try

Code:
public Configuration addDirectory(File dir) throws MappingException


BTW: This is a RTM question!

HTH
Ernst


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 11, 2004 5:08 pm 
Regular
Regular

Joined: Thu Oct 07, 2004 4:45 pm
Posts: 92
Sorry, should have been more specific: Is there any way to do this using the XML configuration file? (I don't see that mentioned in the manual.)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 12, 2004 2:45 am 
Expert
Expert

Joined: Thu Jan 29, 2004 2:31 am
Posts: 362
Location: Switzerland, Bern
AFAIK no.

But you can add your own property, get it from the configuration and call the mentioned method.
Unfortunately the configuration dtd does not allow to have no mapping tag, also this works fine. So you have to specify a dummy hbm.xml or patch the dtd.

Or just put everything into one mapping file.

HTH
Ernst


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 12, 2004 2:55 am 
Expert
Expert

Joined: Tue Oct 05, 2004 9:45 am
Posts: 263
i think i will extend "Configuration" and patch the dtd ...
so i can do something link "<mapping directory=""/>" ...

gtx
curio


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 14, 2004 4:23 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
ernst_pluess wrote:
AFAIK no.

Unfortunately the configuration dtd does not allow to have no mapping tag, also this works fine. So you have to specify a dummy hbm.xml or patch the dtd.



Not true anymore. The DTD allows 0 to N mappings now.

_________________
Max
Don't forget to rate


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