gpt4 book ai didi

java - hibernate 注释问题

转载 作者:行者123 更新时间:2023-12-01 06:02:24 25 4
gpt4 key购买 nike

我的Spring Boot应用程序中的实体类有问题。以下是来自控制台的错误消息
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;
}

}

最佳答案

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;

关于java - hibernate 注释问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54485947/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com