by BehindJava

org.hibernate.HibernateException Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set

Home » springboot » org.hibernate.HibernateException Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set

In this tutorial we are going to learn about resolving the org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when ‘hibernate.dialect’ not set.

Remove the redundant Hibernate Configuration

If you’re using Spring Boot, you don’t need to provide the JPA and Hibernate configuration explicitly, as Spring Boot can do that for you.

Add database configuration properties

In the application.properties Spring Boot configuration file, you have the add your database configuration properties:

spring.datasource.driverClassName = org.postgresql.Driver
spring.datasource.url = jdbc:postgresql://localhost:5432/teste
spring.datasource.username = klebermo
spring.datasource.password = 123

Add Hibernate specific properties

And, in the same application.properties configuration file, you can also set custom Hibernate properties:

# Log SQL statements
spring.jpa.show-sql = false

# Hibernate ddl auto for generating the database schema
spring.jpa.hibernate.ddl-auto = create

# Hibernate database Dialect
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect

That’s it!