반응형
문제 상황
Spring Boot 3.x에서 4.0으로 마이그레이션 후, 테스트 실행 시 다음과 같은 에러가 발생했음.
ERROR: column u1_0.adultCertificatedAt does not exist
hibernate naming strategy 를 org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy, org.hibernate.boot.model.naming.PhysicalNamingStrategySnakeCaseImpl 설정했는데도 camelCase가 snake_case로 안 바뀜.
원인, 해결
hibernate7 부터 naming strategy 에 따옴표 있는 경우 처리하는 로직이 변경된듯.globally_quoted_identifiers 말고 auto_quote_keyword 사용하도록 변경
spring:
jpa:
hibernate:
naming:
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategySnakeCaseImpl
implicit-strategy: org.springframework.boot.hibernate.SpringImplicitNamingStrategy
properties:
hibernate:
# globally_quoted_identifiers: true ← 이거 빼고
auto_quote_keyword: true # ← 이거 쓰기
ref: https://github.com/spring-projects/spring-data-jpa/issues/4091
반응형
'컴퓨터 > Spring + JPA' 카테고리의 다른 글
| [인텔리제이 DTO generator] json data 자동으로 entity class 생성하기 (0) | 2021.06.29 |
|---|---|
| [해결방법] JPA MySQL server version for the right syntax to use (0) | 2021.03.13 |
| 관계형 db vs 그래프 db에 대한 고민 (0) | 2021.03.07 |
| [Spring JPA] OneToOne N+1 문제 (원인 해결방법 포함) (0) | 2021.01.10 |
| [스프링] spring bean 과 java bean의 차이점! (0) | 2020.11.10 |