休眠注释问题

时间:2019-02-01 19:23:07

标签: java hibernate spring-boot

springboot应用程序中的实体类出现问题。下面是来自控制台的错误消息
Caused by: org.hibernate.AnnotationException: No identifier specified for entity: com.stap.entities.User
我的实体类用户看起来如下:

@Entity
public class User {
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    private Integer ID;

    private String name;

    private String email;


    public Integer getID() {
        return ID;
    }

    public void setID(Integer iD) {
        ID = iD;
    }

    public String getName() {
        return name;
    }

}

1 个答案:

答案 0 :(得分:-1)

Hola yo no he utilizado Springboot pero hibernate si,tal vez el formato sea el issuea

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;





 @Entity
    @Table(name = "Usuario")
    public class Usuario {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "idUsuario")
    private int idUsuario;
    @Column(name = "Nombre")
    private String nombre;
    @Column(name = "Contrasena")
    private String contrasena;
    @Column(name = "Apodo")
    private String apodo;
    @Column(name = "Rol")
    private String rol;
    @Column(name = "Estado")
    private String estado;