org.hibernate.MappingNotFoundException: *.hbm.xml not found

风流不在谈锋胜,袖手无言味最长。这篇文章主要讲述org.hibernate.MappingNotFoundException: *.hbm.xml not found相关的知识,希望能为你提供帮助。
对于Maven工程,编译的工作是由Maven程序来完成的,而Maven默认只会把src/main/resources文件夹下的文件拷贝到target/classes文件夹下,.hbm.xml不会被复制到/target/calsses文件夹下,所以Hibernate运行的时候,就会报找不到*.hbm.xml的错误。
【org.hibernate.MappingNotFoundException: *.hbm.xml not found】解决方法:
在pom.xml中显式地指定Maven把什么资源文件复制到target/classes文件夹下。

< build> < resources> < resource> < directory> src/main/java< /directory> < includes> < include> **/*.xml< /include> < /includes> < filtering> true< /filtering> < /resource> < resource> < directory> src/main/resources< /directory> < includes> < include> **/*.xml< /include> < include> **/*.properties< /include> < /includes> < /resource> < /resources> < /build>



    推荐阅读