Hi,

I just started converting a Java project using Hibernate (www.hibernate.org) to
build with Maven rather than Ant. While I was able to get log4j logging working
again by placing my log4j.properties file in src/main/resources, and putting
hibernate.cfg.xml in the same place does result in it getting picked up by
Hibernate at runtime, I can't seem to get the mapping resource entries correct.

My directory structure is now

src/main
        \ resources
        |          \ hibernate.cfg.xml
        |
        \ java/cedar/hepdata/model
                                  \ Author.hbm.xml
                                  \ Axis.hbm.xml
                                  \ etc.

and in hibernate.cfg.xml, I've got mapping entries like this:

<mapping resource="src/main/java/cedar/hepdata/model/Author.hbm.xml"/>

which result in errors like

Running cedar.hepdata.AppTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.109 sec
Running cedar.hepdata.test.HDOMTest
Initial SessionFactory creation failed: org.hibernate.MappingNotFoundException:
resource: src/main/java/cedar/hepdata/model/Author.hbm.xml not found

I've also tried resource="/src/...", resource="../src/..." and a bunch of
others (even absolute paths, which are useless from a portability point of
view) and none seem to work. Any suggestions? I suspect that the
hibernate.cfg.xml file is getting copied into the target/{,test-}classes
directories and the *.hbm.xml files aren't: should the *.hbm.xml files also be
located in src/main/resources/ to make this work?

Please help!

Andy


PS. Sorry if this is a recurring question: The only mention on the mailing list
archives that I've seen about getting Hibernate working was using mappings like
<mapping class="cedar.hepdata.model.Author" />
but these seem to require Hibernate Annotations and I'm not (yet) using them.
The Hibernate doc/FAQ pages aren't much help either, since they only seem to be
referring to Maven 1.x.

-- 
Andy Buckley: CEDAR @ IPPP, Durham
Work: www.cedar.ac.uk
www.insectnation.org

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to