본문 바로가기

공부/Spring

스프링 부트 3 백엔드 개발자 되기_6

어제 문제

Entity has no identifier

 

=> 아래 글로 해결함

https://sudo-minz.tistory.com/122

 

No identifier specified for entity 문제 해결 방법

No identifier specified for entity 문제 해결 방법 다음과 같은 오류가 발생하면.. nested exception is org.hibernate.AnnotationException: No identifier specified for entity: com.minji.site.domain.Member 해당 클래스의 @Id 어노테이

sudo-minz.tistory.com

@Id 어노테이션이 무엇을 import 하고 있는가?

만약 import org.springframework.data.annotation.Id가 import되어 있다면

다음과 같이 import javax.persistence.Id로 수정

 

2.

org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "MEMBER" not found

책에서 지우라는 거 삭제 안해서 그런듯

resources 에서 data.sql 삭제했더니 돌아감 

 

 

3.http://localhost:8080/h2-console

 

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Fri Aug 04 08:28:54 KST 2023
There was an unexpected error (type=Not Found, status=404).
 
=>확인중
application.yml 설정

spring:
  jpa:
    #전송 쿼리 확인
    show-sql: true
    properties:
      hibernate:
        format_sql: true

    defer-datasource-initialization: true

    datasource:
      url: jdbc:h2:mem:testdb


    h2:
      console:
        enabled: true