No identifier specified for entity: springboot-jpa报错No identifier specified for entity
说明:此次学习使用了springboot框架,jpa注解映射实体类
1,No identifier specified for entity: com.tf.model.User
看到此错误第一反应百度谷歌。(经过一阵检索)看到了答案
原因:pojo实体bean缺少了主键
于是返回项目中查看实体类
@Id
@GeneratedValue(strategy= GenerationType.AUTO)
private Long id;
- 1
- 2
- 3
- 4
- 5
缺少主键?开玩笑奥,我都有!细心的我又看了看数据表中字段设置,还是没有任何问题!啊!天将降大任于斯人也!幸好我聪明伶俐,经过一番折腾(此处省略半天时间),终于发现了问题!
正文开始!
原因:包没有引对(类名相同,但不同的包有同一种类)
改正前(部分):
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Id;
- 1
- 2
- 3
改正后:
import javax.persistence.*;
- 1
没错,这两个包中同时有@id,而持久话用到声明主键的@ID在javax.persistence.*中,如果两个包同时存在,正确的这个会被覆盖(至于为什么,sorry,I don’t know)
2,Establishing SSL connection without server’s identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn’t set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to ‘false’. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
这个是报出的一个警告!
原因:在高版本mysql中需要指定是否进行SSL连接
解决方案:配置文件中在spring.datasource.url 加入选项useSSL=false/true
No identifier specified for entity: springboot-jpa报错No identifier specified for entity的更多相关文章
- 从async await 报错Unexpected identifier 谈谈对上下文的理解
原文首发地址: 先简单介绍下async await: async/await是ES6推出的异步处理方案,目的也很明确:更好的实现异步编程. 详细见阮大神 ES6入门 现在说说实践中遇到的问题:使用 ...
- 运行springboot项目报错:Field userMapper in XX required a bean of type 'xx' that could not be found.
运行springboot项目报错: *************************** APPLICATION FAILED TO START ************************** ...
- java报错:The reference to entity "characterEncoding" must end with the ';' delimiter.
java关于报错:The reference to entity "characterEncoding" must end with the ';' delimiter. Java ...
- jpa报错 Unable to acquire a connection from driver [null], user [null] and URL [null]
jpa报错 Unable to acquire a connection from driver [null], user [null] and URL [null] 为啥报错 因为你在persist ...
- SpringBoot启动报错Failed to determine a suitable driver class
SpringBoot启动报错如下 Error starting ApplicationContext. To display the conditions report re-run your app ...
- springboot 启动报错"No bean named 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' available"
1.问题 springboot启动报错 "D:\Program Files\Java\jdk-11\bin\java.exe" -XX:TieredStopAtLevel=1 -n ...
- SpringBoot启动报错:ould not be registered. A bean with that name has already been defined in file and overriding is disabled.
SpringBoot启动报错 ***************************APPLICATION FAILED TO START*************************** Des ...
- SpringBoot报错: No identifier specified for entity: XXX.XXX.XXX.XXX
今天练习的时候报错说是 : 没有为实体指定标识符 仔细看了实体类才发现忘记写了一些注解 用JPA写实体类时一些注解是必须的 @entity 标名本类是实体类 @table(name="表名 ...
- Jpa 报错 :HTTP Status 400 - Required String parameter 'xx' is not present
一.问题描述 使用Springboot JPA 做分页查询,报错Required String parameter 'xx' is not present,后端未接受到请求 二.解决方案: 使用的请求 ...
- JavaScript在IE6,IE7下报错'expected identifier, string or number'
问题: 代码在Forefox和IE8下工作正常,但是在IE6下报错: expected identifier, string or number 假如变量options有多个选项,那么我们可以用逗号分 ...
随机推荐
- CSS3选择器01—CSS2.1部分选择器
这篇文章主要用于存储CSS以及CSS3的选择器部分知识,以便日后查阅及记忆. 该内容分为两部分,第一部分为css选择器的一些基本知识.第二部分为CSS3新增加的选择器. 在开始之前,先简单介绍一下选择 ...
- leetcode 树的锯齿形状遍历
二叉树的锯齿形层次遍历 给定一个二叉树,返回其节点值的锯齿形层次遍历.(即先从左往右,再从右往左进行下一层遍历,以此类推,层与层之间交替进行). 例如:给定二叉树 [3,9,20,null,n ...
- python中关于if-else使用性能的一点感悟
今天做leetcode第7题关于数字倒序的问题,分别使用如下程序:(72ms) class Solution: def reverse(self, x): """ :ty ...
- "Unchecked-Send"漏洞分析
author:sf197tl;dr国内并没有一个文档有讲述该漏洞的,正好闲着没事.就写下这篇文章.在网上也搜寻了一些资料,通过自己的翻译才有今天的这篇文章.该漏洞在DASP TOP 10中可以查看到. ...
- 使用 IntraWeb (20) - 基本控件之 TIWGrid
TIWGrid 最终通过 Html Table 呈现; 其每个 Cell 都是一个 TIWGridCell 对象, Cell 对象的 Control 属性非常好, 可以非常方便地嵌入其他控件. TIW ...
- CAT架构的应用与实践 IT大咖说 - 大咖干货,不再错过
CAT架构的应用与实践 IT大咖说 - 大咖干货,不再错过 http://www.itdks.com/dakashuo/new/dakalive/detail/594
- delphi ribbon使用
http://blog.csdn.net/davinciyxw/article/details/5604209 1.TextEditor(barEditItem)取文本 string editValu ...
- Vue 插件写法
都说Vue2简单,上手容易,但小马过河,自己试了才晓得,除了ES6语法和webpack的配置让你感到陌生,重要的是思路的变换,以前随便拿全局变量和修改dom的锤子不能用了,变换到关注数据本身.vue的 ...
- AngularJS路由系列(2)--刷新、查看路由,路由事件和URL格式,获取路由参数,路由的Resolve
本系列探寻AngularJS的路由机制,在WebStorm下开发.主要包括: ● 刷新路由● 查看当前路由以及所有路由● 路由触发事件● 获取路由参数 ● 路由的resolve属性● 路由URL格式 ...
- 监测uitableview 向上滑动和向下滑动的事件
- (void)scrollViewDidScroll:(UIScrollView *)scrollView { CGFloat height = _varietyTableView.frame.si ...