maven工程下hibernate报错;Mapping (RESOURCE) not found;
声明使用 hibernate5.0.7版本,JDK8进行测试;
*maven工程报错,由于maven对项目管理,编译是target 目录下,所有找不到 配置文件;报错maven工程Mapping (RESOURCE) not found *
所以更改 pom.xml 配置,告知 hibernate框架 在maven工程编译过后的路径中加载 xxx.hbm.xml 配置文件即可;
<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>
我的 maven工程目录结构如下:
更改过后:
刷新 mysql 数据库:
使用maven 工程来管理 hibernate ;
参考自:https://blog.csdn.net/kuaisuzhuceh/article/details/44728629
还没有评论,来说两句吧...