본문 바로가기

트러블슈팅/SPRING

[스프링부트]No identifier specified for entity

Caused by: org.hibernate.AnnotationException: 
No identifier specified for entity: hello.hellospring.domain.Member

 

import org.springframework.data.annotation.Id;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;

@Entity
public class Member {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

 

오류를 잘 읽어 보면 AnnotationExcpertion이 발생 했음을 알 수 있다. 

import org.springframework.data.annotation.Id가 import되어 있을 수 있다.

그럴 경우 import javax.persistence.Id로 수정하면 된다.