omarAhmed
omarAhmed

Reputation: 1

Hibernate Dialect issue - Spring Boot

I get the following exception after upgrading Spring Boot version from 2.4.0 to 2.7.8

java.util.ConcurrentModificationException
stack-trace :-
Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set

database:- MariaDB, Spring Boot 2.7.8

I am searching for a long time and checked the following points that people thought might be the causes of this exception

1- have checked DB name , credentials >> and I see there is nothing to do with checking DB connection strings as the same connection works fine once downgraded spring boot version to 2.4.0
2- this is my properties file so there is nothing to do with adding dialect or so

3- I have tried to exclude auto-configuration classes from @SpringBootApplication main class as I am using custom data source bean configurations.

also, I have no control over the way data source beans are initialized as I am using a dependency owned by another group
enter image description here

Upvotes: 0

Views: 2958

Answers (1)

rjdkolb
rjdkolb

Reputation: 11888

I suggest you set the dialect in your configuration.

# Data source configuration
spring.datasource.url=jdbc:mariadb://localhost:3306/db
spring.datasource.username=x
spring.datasource.password=x
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver

# set the dialect  
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MariaDBDialect

Also make sure you have the driver available in your pom/grade.

Maven:

<dependency>
    <groupId>org.mariadb.jdbc</groupId>
    <artifactId>mariadb-java-client</artifactId>
</dependency>

Upvotes: 0

Related Questions