内容简介:原文地址:https://www.miaoroom.com/code/note/mybatis-debug-notes.html出处:喵容
原文地址:https://www.miaoroom.com/code/note/mybatis-debug-notes.html
出处:喵容
本文会零零碎碎的更新自己在学习 Java 和 Mybatis 碰到的问题和解决办法,希望这些踩坑的历程能给需要的你带来帮助。
由于文章主要为DAO层的内容,所以本文同时也会收录部分 Hibernate 和 SpringData 的内容,而不仅仅是只有Mybatis。
1. org.hibernate.AnnotationException: No identifier specified for entity:
private Integer categoryId;
这个错误看上去是这张表没有主键,在使用hibernate的映射表的时候entity类是必须要主键的,否则就会报出这个异常。所以解决如下,添加自增的ID主键:
@Id @GeneratedValue private Integer categoryId;
如果我们已经配置了@ID,还会报这个错误是因为import错包了,错误的使用了org.springframework.data.annotation.Id包。
当我们使用@Entity的时候,提示我们Entity过时,被划了横线,是因错误的引用了org.hibernate.annotations.Entity包,这里应该使用JPA的注解javax.persistence.Entity,而不是hibernate的。
以上所述就是小编给大家介绍的《「Mybatis笔记」 Mybatis 的踩坑之路(集中更新)》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:- Golang 热更新研究笔记
- Vue踩坑笔记(更新ing)
- VNote 1.12 更新,基于 Qt 的开源笔记软件
- 基于 Qt 的开源笔记软件 VNote 1.11.1 小更新发布
- 云办公系统 skyeye v3.4.2 发布,笔记,行政,知识库更新
- 云办公系统 skyeye v3.5.1 发布,工作流模块以及笔记模块更新
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
The Apache Modules Book
Nick Kew / Prentice Hall PTR / 2007-02-05 / USD 54.99
"Do you learn best by example and experimentation? This book is ideal. Have your favorite editor and compiler ready-you'll encounter example code you'll want to try right away. You've picked the right......一起来看看 《The Apache Modules Book》 这本书的介绍吧!
CSS 压缩/解压工具
在线压缩/解压 CSS 代码
HEX CMYK 转换工具
HEX CMYK 互转工具