Force Hibernate to use user-defined Dialect with Spring boot autoconfiguration

536 Views Asked by At

I try to deploy a Spring boot app that use a MariaDB database with autoconfiguration to the a Cloud foundry platform, my app work as expected in Pivotal CFY, but when i deploy it to an on-premise CFY plateform i have an error related to Hibernate Dialect.

INFO 13 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
....
Caused by: java.sql.SQLSyntaxErrorException: (conn=1279230) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'type=MyISAM' at line 1

i want to exclude spring boot autoconfiguration for Hibernate dialect to use the user-defined one.

i specified my dialect and jpa properties in application.properties with :

spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.properties.hibernate.dialect.storage_engine=innodb
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MariaDB103Dialect

and in hibernate.properties

hibernate.dialect = org.hibernate.dialect.MariaDB10Dialect

But when i run my app i see in logs that spring autoconfiguration overide the Dialect that i specified.

   2018-11-07T11:17:05.57+0100 [APP/PROC/WEB/0] OUT 2018-11-07 10:17:05.577  INFO 13 --- [           main] org.hibernate.cfg.Environment            : HHH000205: Loaded properties from resource hibernate.properties: {hibernate.dialect=org.hibernate.dialect.MariaDB10Dialect, hibernate.bytecode.use_reflection_optimizer=false, hibernate.connection.driver_class=org.mariadb.jdbc.Driver}
   2018-11-07T11:17:06.37+0100 [APP/PROC/WEB/0] OUT 2018-11-07 10:17:06.368  INFO 13 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
0

There are 0 best solutions below