Home >Java >javaTutorial >Why Does My Spring Boot Hibernate Application Throw \'org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when \'hibernate.dialect\' not set\'?
When attempting to run a Spring-Boot application that utilizes Hibernate via Spring-JPA, you may encounter the following error:
org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
This error indicates that the Hibernate dialect has not been properly configured. The dialect is responsible for translating database-specific SQL commands.
To resolve this error, follow these steps:
If you need to access the SessionFactory directly, you can use the following code snippet:
@Bean public HibernateJpaSessionFactoryBean sessionFactory(EntityManagerFactory emf) { HibernateJpaSessionFactoryBean factory = new HibernateJpaSessionFactoryBean(); factory.setEntityManagerFactory(emf); return factory; }
Alternatively, you can obtain a SessionFactory by casting the EntityManagerFactory to it, as of Hibernate 5.
The above is the detailed content of Why Does My Spring Boot Hibernate Application Throw \'org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when \'hibernate.dialect\' not set\'?. For more information, please follow other related articles on the PHP Chinese website!