在使用SpringBoot+Hibernate 对数据库操作时,无法自动新建表,报错如下。

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: No identifier specified for entity: com.liuyanzhao.blog.Userat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1078) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:857) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]at com.liuyanzhao.blog.BlogApplication.main(BlogApplication.java:13) [classes/:na]
Caused by: org.hibernate.AnnotationException: No identifier specified for entity: com.liuyanzhao.blog.Userat org.hibernate.cfg.InheritanceState.determineDefaultAccessType(InheritanceState.java:265) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]at org.hibernate.cfg.InheritanceState.getElementsToProcess(InheritanceState.java:211) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:717) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]at org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.processEntityHierarchies(AnnotationMetadataSourceProcessorImpl.java:245) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.processEntityHierarchies(MetadataBuildingProcess.java:222) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:265) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:847) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final]at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:874) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final]at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60) ~[spring-orm-4.3.12.RELEASE.jar:4.3.12.RELEASE]at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:353) ~[spring-orm-4.3.12.RELEASE.jar:4.3.12.RELEASE]at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:370) ~[spring-orm-4.3.12.RELEASE.jar:4.3.12.RELEASE]at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:359) ~[spring-orm-4.3.12.RELEASE.jar:4.3.12.RELEASE]at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624) ~[spring-beans-4.3.12.RELEASE.jar:4.3.12.RELEASE]... 16 common frames omitted

其中的 jpa 的依赖是导入了的。

后来发现是注解导错了包,不小心把 Id 的注解导错了

报错Caused by: org.hibernate.AnnotationException: No identifier specified for entity: com.liuyanzhao.blog.User

报错Caused by: org.hibernate.AnnotationException: No identifier specified for entity: com.liuyanzhao.b相关推荐

  1. 报错Caused by: org.hibernate.AnnotationException: No identifier specified for entity:

    Caused by: org.hibernate.AnnotationException: No identifier specified for entity:. 原因: 1.没有给实体类ID 解决 ...

  2. org.hibernate.AnnotationException: No identifier specified for entity

    Caused by: org.hibernate.AnnotationException: No identifier specified for entity: 使用hibernate的e-r映射p ...

  3. org.hibernate.annotationexception no identifier specified for entity

    解决:org.hibernate.annotationexception no identifier specified for entity HibernateEJB  org.hibernate. ...

  4. Maven项目报错:Caused by: java.lang.NoClassDefFoundError: com/fasterxml/classmate/Filter

    一.问题描述 项目一运行就报错: Caused by: java.lang.NoClassDefFoundError: com/fasterxml/classmate/Filterat org.hib ...

  5. 启动tomcat报错Caused by: org.apache.catalina.LifecycleException: No UserDatabase component

    启动tomcat报错 Caused by: org.apache.catalina.LifecycleException: No UserDatabase component 替换conf/tomca ...

  6. EasyExcel导入的时候报错Caused by: java.lang.NoClassDefFoundError: org/apache/poi/poifs/filesystem/File

    今天用EasyExcel导入的时候报错,如下 com.alibaba.excel.exception.ExcelAnalysisException: java.lang.NoClassDefFound ...

  7. Spring报错 Caused by: org.springframework.beans.factory.BeanNotOfRequiredTypeException

    报错信息: Caused by: org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'bookC ...

  8. 连接mysql报错Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zon

    连接mysql报错: Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time z ...

  9. oracle插入报错-Caused by: java.sql.SQLException: 无效的列类型: 16

    一.问题截图 如图我们用kettle将SqlServer数据抽取至oracle数据,因两边数据库的字段类型不一致,导致数据同步过去时报Caused by: java.sql.SQLException: ...

  10. oracle 数据转换不报错,oracle数据库与hibernate方言转型异常

    oracle数据库与hibernate方言转型异常 报错信息: org.hibernate.MappingException: No Dialect mapping for JDBC type: -9 ...

最新文章

  1. 网络工程学习资料2---IEEE 802 标准集合
  2. 抓包分析TCP的三次握手和四次分手
  3. Graylog2+mongdb+rsyslog中央日志服务器对syslog的web管理--转载
  4. LeetCode:跳跃游戏【55】
  5. 从原理到实践手动拼凑一个Linux系统
  6. asp.net core监控—引入Prometheus(一)
  7. 15-[JavaScript]-ECMAScript 1
  8. php是阻塞模式吗,PHP非阻塞模式 - 黑白大熊猫的个人空间 - OSCHINA - 中文开源技术交流社区...
  9. 今晚8点不见不散!余承东Vlog如此夸赞华为Mate30系列新机
  10. 苹果损失超 1000 万美元,前员工被控收回扣、盗窃、欺诈
  11. (转)法线贴图Nomal mapping 原理
  12. 程序异常exitcode非0_ARM寄存器分析以及异常处理方法
  13. Response.End() 与Response.Close()的区别
  14. 帆软动态分页之嵌套自定义参数据选择行数分页
  15. android gps 经纬度转换,AndroidGPS获取当前经纬度坐标
  16. 目标检测中的非极大值抑制(NMS)
  17. Python爬取中国天气网天气数据
  18. ROS2入门教程—录制/回放数据
  19. SageMath | Crypto Tool
  20. 形容等待时间长的句子_形容等待了很久的句子

热门文章

  1. django -- url 的 命名空间
  2. 验证iaas的sql服务器出现error configuring vRealize automation server
  3. 【Python学习笔记】集合set
  4. Android基础知识、四大组件(转)
  5. 12步让你的web1.0变成web2.0
  6. 深入浅出Linux设备驱动编程--引言
  7. java去除网页中的广告和导航等信息_**css+html纯css怎样去除导航子菜单中的默认背景?**...
  8. mysql如何从两个表取出内容_如何从mysql中的两个表中获取数据?
  9. 测试用例文档_如何设计测试用例
  10. linux下修改mysql数据存储_Linux下修改MySQL数据存放目录方法及可能遇到的问题--转...