-->
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: Can hibernate automatically find *.hbm.xml files at runtime?
PostPosted: Thu Jun 02, 2005 9:40 am 
Beginner
Beginner

Joined: Thu Jun 02, 2005 9:36 am
Posts: 20
I was hoping that Hibernate would automatically find *.hbm.xml files that were in the same package and named the same as their respective classes. This doesn't seem to occur and I couldn't find it in the documentation. The docs I found all seem to require the mapping files to be prespecified in the hibernate.cfg.xml file. I am in a situation where I cannot do that because I do not know at build time which classes will have mappings. Is there a configuration flag or something that will have Hibernate automatically find the mapping files at runtime?

Thank you.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 02, 2005 9:45 am 
Expert
Expert

Joined: Thu May 26, 2005 9:19 am
Posts: 262
Location: Oak Creek, WI
Hi

The mapping files will be read at the startup itself.

So i you add a mapping file and add a entry for that in the hibernate.cfg.xml until the server is restarted the file will not be counted.

Can anybody give some more answer to this?

_________________
RamnathN
Senior Software Engineer
http://www.linkedin.com/in/ramnathn
Don't forget to rate.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 02, 2005 12:44 pm 
Expert
Expert

Joined: Wed Apr 06, 2005 5:03 pm
Posts: 273
Location: Salt Lake City, Utah, USA
You can use Configuration.addResource() or addClass() to add mapping files at runtime.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 02, 2005 5:04 pm 
Newbie

Joined: Thu May 05, 2005 12:58 pm
Posts: 3
You can also use Configuration.addDirectory(File).

This way all .hbm.xml in this directory will be processed by hibernate. If you need to add a new class, just put its mapping in the directory you specified.


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.