springboot 3.24 hibernete 6.44 jdk 21
error with: Suppressed: java.lang.ClassNotFoundException: org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
Searched on internet that SpringPhysicalNamingStrategy was deprecated, using CamelCaseToUnderscoresNamingStrategy instead. but I still failed after I updated the settings ,
spring:
jpa:
hibernate:
naming:
physical-strategy: org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy
#physical-strategy: org.springframework.boot.orm.jpa.hibernate.CamelCaseToUnderscoresNamingStrategy
#physical-strategy: org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
#physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
#implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
I tried to generate a totally new project by using spring initializr, copy only database related codes in it, and it also failed.
finally fixed, the correct config was:
properties.put("hibernate.dialect", "org.hibernate.dialect.MySQLDialect");
properties.put("hibernate.ddl-auto", "update");
properties.put("hibernate.id.new_generator_mappings", "false");
properties.put("hibernate.physical_naming_strategy", "org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy");
first, using MySQLDialect instead of MySQL5InnoDBDialect, it's deleted. second,using "org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy" not springframework jar.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With