-->
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.  [ 2 posts ] 
Author Message
 Post subject: addClass cannot find mapping files
PostPosted: Fri Aug 13, 2004 4:48 pm 
Newbie

Joined: Tue Jul 27, 2004 1:33 pm
Posts: 18
Location: South Africa
Hibernate version:2.1.6

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:
net.sf.hibernate.MappingException: Resource: za/co/clarkeconsulting/mssql/msdb/dataobjects/Backupfile.hbm.xml not found
at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:349)
at za.co.clarkeconsulting.mssql.dts.Config.buildHibernateConfigurations(Config.java:100)
at za.co.clarkeconsulting.mssql.dts.Config.configureHibernate(Config.java:88)
at za.co.clarkeconsulting.mssql.dts.Config.Configure(Config.java:60)
at za.co.clarkeconsulting.applicationmonitor.tests.PackageTest.testPackage(PackageTest.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)


Name and version of the database you are using:

Debug level Hibernate log excerpt:

Hi all,


I am trying to cconfigure the session factory manually. With the following code:

Properties prop = buildHibernateProperty(node);
Configuration cfg = new Configuration();
cfg.setProperties(prop);
try {
cfg.addClass(Backupfile.class);


I keep getting an error that the resource cannot be found. This is wierd as if I use the cfg.configure() method then the files are found ok. All I do in the code is replace the addClass method with Configure(). I need to configure it manually as there may be more than one database for which I need to create a sessionFactory.

thanks


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 14, 2004 1:32 am 
Expert
Expert

Joined: Thu Jan 29, 2004 2:31 am
Posts: 362
Location: Switzerland, Bern
Read Hibnerhate Reference Chapter 3.1 and the JavaDoc of Configuration. IF your still in doubt the source code of Configuration.java helps as well.

You have to understand exaclty where in the classpath ore somewhere else the hbm.xml is looked up. It's different for the various add methods.

In your case it want's to have it in
Code:
za/co/clarkeconsulting/mssql/msdb/dataobjects/Backupfile.hbm.xml

but it's somwhere else.


HTH
Ernst


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