说明:此次学习使用了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

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_33240946/article/details/52916532

No identifier specified for entity: springboot-jpa报错No identifier specified for entity的更多相关文章

  1. 从async await 报错Unexpected identifier 谈谈对上下文的理解

    原文首发地址: 先简单介绍下async await: async/await是ES6推出的异步处理方案,目的也很明确:更好的实现异步编程.   详细见阮大神 ES6入门 现在说说实践中遇到的问题:使用 ...

  2. 运行springboot项目报错:Field userMapper in XX required a bean of type 'xx' that could not be found.

    运行springboot项目报错: *************************** APPLICATION FAILED TO START ************************** ...

  3. java报错:The reference to entity "characterEncoding" must end with the ';' delimiter.

    java关于报错:The reference to entity "characterEncoding" must end with the ';' delimiter. Java ...

  4. 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 ...

  5. SpringBoot启动报错Failed to determine a suitable driver class

    SpringBoot启动报错如下 Error starting ApplicationContext. To display the conditions report re-run your app ...

  6. 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 ...

  7. 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 ...

  8. SpringBoot报错: No identifier specified for entity: XXX.XXX.XXX.XXX

    今天练习的时候报错说是 : 没有为实体指定标识符 仔细看了实体类才发现忘记写了一些注解 用JPA写实体类时一些注解是必须的 @entity  标名本类是实体类 @table(name="表名 ...

  9. Jpa 报错 :HTTP Status 400 - Required String parameter 'xx' is not present

    一.问题描述 使用Springboot JPA 做分页查询,报错Required String parameter 'xx' is not present,后端未接受到请求 二.解决方案: 使用的请求 ...

  10. JavaScript在IE6,IE7下报错'expected identifier, string or number'

    问题: 代码在Forefox和IE8下工作正常,但是在IE6下报错: expected identifier, string or number 假如变量options有多个选项,那么我们可以用逗号分 ...

随机推荐

  1. 跟厂长学PHP7内核(八):深入理解字符串的实现

    在前面大致预览了常用变量的结构之后,我们今天来仔细的剖析一下字符串的具体实现. 一.字符串的结构 struct _zend_string { zend_refcounted_h gc; /* 字符串类 ...

  2. AngularJS过滤器filter入门

    在开发中,经常会遇到这样的场景 如用户的性别分为“男”和“女”,在数据库中保存的值为1和0,用户在查看自己的性别时后端返回的值自然是1或0,前端要转换为“男”或“女”再显示出来: 如我要换个羽毛球拍, ...

  3. js控制手机端字体大小rem

    //得到手机屏幕的宽度 let htmlWidth = document.documentElement.clientWidth || document.body.clientWidth; if(ht ...

  4. VScode 光标乱跳

    JS-CS_html formatter 卸载这个插件 如果没有,或者卸载跟这个类似的,如果还是没有就忽略这个 如果设置过自动保存 在配置上修改为 "files.autoSaveDelay& ...

  5. Win7无法添加用户的问题

    这段时间搞dcom的东西,然后按照网上说的,用dcomcnfg打开管理器,在dcom中我的电脑里面属性中把默认身份验证级别改为 无.然后再使用的时候,发现win7中的账户管理里面,什么账户都没有了,不 ...

  6. Android activity之间数据传递和共享的方式之Application

    1.基于消息的通信机制  Intent ---bundle ,extra 数据类型有限,比如遇到不可序列化的数据Bitmap,InputStream,或者LinkedList链表等等数据类型就不太好用 ...

  7. AIM Tech Round 3 (Div. 1) B. Recover the String 构造

    B. Recover the String 题目连接: http://www.codeforces.com/contest/708/problem/B Description For each str ...

  8. Reactor与Proactor比较

    from http://www.cnblogs.com/dawen/archive/2011/05/18/2050358.html 1.标准定义 两种I/O多路复用模式:Reactor和Proacto ...

  9. WebLogic使用总结(三)——WebLogic配置JNDI数据源

    一.在WebLogic新建针对Oracle数据库的JNDI数据源 进入weblogic管理控制台,此处是远程访问:http://192.168.1.144:7001/console 点击左侧[ 域结构 ...

  10. Android 模拟器设置

    这几个图标你应该是没有见过的,我来简单为你介绍下.最左边的图标其实你已经比较熟悉了,就是你睡觉前使用过的Android SDK管理器,点击它和点击SDK Manager效果是一样的.中间的图标是用来开 ...