解决IDEA使用hibernate出现*.hbm.xml not found的问题
来源:互联网 发布:eureka api java 编辑:程序博客网 时间:2024/05/17 21:54
问题描述
本人初学hibernate,编译器用的是IDEA,但是在编译时却始终出现*.hbm.xml not found的问题,在网上看了很多解决办法,都不能有效的解决,后面解决了才豁然开朗
问题原因
本人使用的编译器是IDEA,建的是maven项目,且实体类和*.hbm.xml文件都是IDEA自己生成的
如上图所示
但这里有一个问题就是IDEA的maven项目和eclipse的maven项目不同。eclipse下的maven项目中,src/main/java目录下不仅可以放置.java源文件,还可以放置其他的资源文件,如*..hbm.xml文件等等。而在intellij idea下的maven项目,src/main/java下只能放置.java源文件,其他资源文件必须放在src/main/resources目录下,比如spring配置文件、hibernate配置文件、.properties文件等。
解决办法1
将所有的.hbm.xml文件移至src/main/resouces目录(或者其子目录)下即可。
解决办法2
对于Maven工程,编译的工作是由Maven程序来完成的,而Maven默认只会把src/main/resources文件夹下的文件拷贝到target/classes文件夹下,所以.hbm.xml文件不会被复制到/target/calsses文件夹下,所以Hibernate框架在运行的时候,就会报*.hbm.xml not found的错误。
方案:
在pom.xml中显式地告诉Maven把什么资源文件复制到target/classes文件夹下。
阅读全文
1 0
- 解决IDEA使用hibernate出现*.hbm.xml not found的问题
- Hibernate 出现org.hibernate.MappingNotFoundException: resource:**.hbm.xml not found问题的解决方案
- maven项目中 org.hibernate.MappingNotFoundException: resource:**.hbm.xml not found问题的解决方案
- maven项目中 org.hibernate.MappingNotFoundException: resource:**.hbm.xml not found问题的解决方案
- maven项目中 org.hibernate.MappingNotFoundException: resource:**.hbm.xml not found问题的解决方案
- 使用Hibernate过程中出现entity class not found 问题的解决思路
- 使用Hibernate过程中出现entity class not found 问题的解决思路
- 配置jbpm环境时,出现org.hibernate.MappingNotFoundException: resource: jbpm.repository.hbm.xml not found
- org.hibernate.MappingNotFoundException: resource: xxx.hbm.xml not found
- org.hibernate.MappingNotFoundException: resource: entity.Students.hbm.xml not found
- hibernate-config.xml not found的问题
- resource: *********.hbm.xml not found 这个错误完美解决
- Hibernate 使用Intellij IDEA自动生成.hbm.xml文件
- SSH框架问题——hbm.xml配置出现的org.hibernate.MappingException: Could not determine type for:(貌似叫数据类型转换错误)问题
- Hibernate错误 org.hibernate.MappingNotFoundException: resource: com/com/Person.hbm.xml not found
- Resource: bean/Product.hbm.xml not found
- resource: ****.hbm.xml not found解决方案
- Hibernate 使用时出现 Could not parse configuration: /hibernate.cfg.xml 的异常问题
- 父子进程间的共享内存通信
- codewars:Convert string to camel case
- Db2: 为什么db2pd显示Db2的lock owner是0?
- 数人云|读完这19本经典,成为优秀架构师其实也不难
- 用root用户操作openwrt
- 解决IDEA使用hibernate出现*.hbm.xml not found的问题
- HS300股指与其成分股的价格匹配
- MYSQL数据库-基础加强
- Java并发编程:volatile关键字解析
- gethibernatetemplate find条件查询方法
- FOR XMI PATH,STUFF 实现字段拼接
- github配置ssh key
- unique函数用法
- 斐波那契数c语言程序