zoukankan      html  css  js  c++  java
  • No identifier specified for entity

    org.hibernate.AnnotationException: No identifier specified for entity

    异常信息

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in
     class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of ini
    t method failed; nested exception is org.hibernate.AnnotationException: No identifier specified for entity
    

    异常原因

    实体类中需要有唯一标识符,需要指定主键

    解决

    在你实体类的主键上加上下面的两个注解即可。

        @Id
        @GeneratedValue
        private Long id;
    
  • 相关阅读:
    Vue过滤器使用
    vue基础
    lesson
    lesson
    lesson
    lesson
    rm 命令详解
    alias 命令详解
    cd 命令详解
    cut 命令详解
  • 原文地址:https://www.cnblogs.com/hoonick/p/11249128.html
Copyright © 2011-2022 走看看