Kriszu
Kriszu

Reputation: 21

Hibernate using deafult dialect instead of dialect from application.properties

I'm using spring boot + jpa + hibernate. There is my application.properties:

spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.database-platform=org.hibernate.dialect.MySQL8nnoDBDialect
  
spring.data.jpa.repositories.enabled=true
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/nodramazone
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driverClassName=com.mysql.jdbc.Driver

But in logs I see default dialect:

org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect

Upvotes: 0

Views: 3334

Answers (2)

coladict
coladict

Reputation: 5095

The property name is wrong. Instead of spring.jpa.database-platform you have to use spring.jpa.properties.hibernate.dialect

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

Upvotes: 1

Paritosh Gupta
Paritosh Gupta

Reputation: 326

Try this:

# MySQL
#spring.datasource.url=jdbc:mysql://localhost:3306/test
#spring.datasource.username=dbuser
#spring.datasource.password=dbpass
#spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect

Upvotes: 0

Related Questions