spring-data-jpa 没有为springJpa中的实体异常指定标识符

7cjasjjr  于 2022-11-10  发布在  Spring
关注(0)|答案(1)|浏览(136)

运行springboot应用程序时出现异常。
异常错误:没有为实体指定标识符:com.model.Location

@Entity
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
@Table(name = "LOCATION", schema = "LOCK")
public class Location implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "LOCATION_ID")
    private int locationId;
    @Column(name = "LOCATION", nullable = false)
    private String location;

    @Column(name = "CREATED_ON", nullable = false)
    private Timestamp CREATED_ON;

    @Column(name = "UPDATED_ON", nullable = false)
    private Timestamp UPDATED_ON;

    /*getter setter methods*/
}
7ivaypg9

7ivaypg91#

请确定已从封装载入识别码:

import javax.persistence.Id;

和否

import org.springframework.data.annotation.Id;

相关问题