-->
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: Possible to reference a map file inside JAR file?
PostPosted: Mon May 07, 2007 1:56 am 
Newbie

Joined: Fri May 04, 2007 3:43 pm
Posts: 18
I'd like to be able to reference my map files that are within JAR library files... for example, I have a WAR with the following (similar) layout:

Code:
+META-INF
     manifest.mf
+WEB-INF
     +classes
          hibernate.cfg.xml
     +lib
           MyJar.jar
                 +META-INF
                  +org
                        +user
                             User.class
                             User.hbm.xml


So, from within hibernate.cfg.xml, how can I reference it to the User.hbm.xml mapping file?


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 07, 2007 6:10 am 
Regular
Regular

Joined: Mon Mar 26, 2007 12:38 am
Posts: 119
Hi,
Add MyJar.jar to classpath.
Then add,
<mapping resource="org/usr/User.hbm.xml"/>
to hibernate.cfg.xml

-----------------------------------------
Rate the reply if you find it helpful


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 07, 2007 7:32 am 
Newbie

Joined: Fri May 04, 2007 3:43 pm
Posts: 18
being that MyJar.jar is inside my .WAR file, I'm a little confused how I can add that to the classpath... ???


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 07, 2007 7:56 am 
Regular
Regular

Joined: Mon Mar 26, 2007 12:38 am
Posts: 119
Friend, I think we are deviating from Hibernate!

The /WEB-INF/classes directory is on the ClassLoader's classpath. This is where .class files are loaded from when the web application is executing. Any JAR files placed in the /WEB-INF/lib directory will also be placed on the ClassLoader's classpath.
( extracted from wikipedia, WAR )


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 07, 2007 9:25 am 
Newbie

Joined: Fri May 04, 2007 3:43 pm
Posts: 18
You're right, too much deviation from Hibernate. Anyway, got it to work - as you mentioned, any JARs inside the lib dir are classpathed. 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.