Notice
Recent Posts
Recent Comments
Link
«   2025/05   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

돌맹이

[JPA] StrategySelectionException Error 본문

programming/JPA

[JPA] StrategySelectionException Error

오택 2023. 6. 7. 17:43

# 오류 발생

Spring에서 JPA를 사용할 때, 다음과 같은 오류가 발생하였다.

org.hibernate.boot.registry.selector.spi.StrategySelectionException: 
Unable to resolve name [org.hibernate.dialect.MySQL5InnoDBDialect] as strategy 
[org.hibernate.dialect.Dialect]

 

# 코드

위 오류는 application.properties 에서 JPA MySQL Storage engine 지정이 제대로 되지 않았을 때 발생한다.

spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect

 

# 해결 방법

해당 부분을 주석처리하여 해결할 수 있다.

#spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect

또는 다음과 같이 지정해 줄 수도 있다.

spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect

현재 JPA는 default로 innoDB를 연결시키기 때문에 따로 Storage Engine을 지정하지 않아도 된다.

하지만 Spring Boot에서 org.hibernate.dialect.MySQLDialect를 작성하는 것을 권장하고있다.

HHH90000026: MySQL57Dialect has been deprecated; use org.hibernate.dialect.MySQLDialect instead