SpringBoot 와 JPA 를 사용하는 환경에서 Local DB와는 문제가 생기지 않았지만, DB서버와 연결하면서 에러가 발생했다.
에러 화면
분명 존재하는 테이블인데 테이블이 존재하지 않는다는 내용의 에러였다.
혹시나 해서 entity에 Table 이름을 추가 해주었지만, 여전히 에러는 발생하는 상황 ㅠㅠ
Local DB로는 문제가 없었기에 의심하지 못 했는데 한참을 구글링한 결과
application.yml
jpa:
generate-ddl: false
hibernate:
ddl-auto: none
naming:
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
properties:
hibernate:
format_sql: true
show_sql: true
jpa를 설정해주는 부분에 naming전략을 따로 설정해줘야 했다.
설정 후
콘솔 창에 에러가 발생하지 않고 원하던 SQL문이 제대로 실행이 되는 것을 볼 수 있었다.
yml 사용하지 않는 경우
properties에 설정을 해주면 된다.
spring.jpa.hibernate.naming.physical-strategy = org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
참고용 설정
SpringPhysicalNamingStrategy(Default)
=> camel case를 underscore 형태로 변경
PhysicalNamingStrategyStandardImpl
=> 변수 이름을 그대로 사용
'오류 해결' 카테고리의 다른 글
[spring boot] Gradle로 빌드 시 에러 (0) | 2022.12.08 |
---|---|
[MariaDB]Autoincrement 재정렬 (0) | 2022.10.28 |
context를 불러와 intent로 activity를 실행시킬 시 오류 (0) | 2022.08.19 |
DBeaver와 mariadb 연결 오류 (0) | 2022.07.07 |