码迷,mamicode.com
首页 > 编程语言 > 详细

Spring Boot下使用JPA报错:'hibernate.dialect' not set的解决办法

时间:2021-04-23 12:28:00      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:sans   initial   database   eth   abstract   san   span   文件格式   term   

Spring Boot  下使用JPA,报org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when ‘hibernate.dialect‘ not set错误,异常信息如下:

  1. Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when ‘hibernate.dialect‘ not set
  2. at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:104)
  3. at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:71)
  4. at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:205)
  5. at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:111)
  6. at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:234)
  7. at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
  8. at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1885)
  9. at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1843)
  10. at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850)
  11. at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:843)
  12. at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:398)
  13. at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:842)
  14. at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:152)
  15. at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:336)
  16. at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318)
  17. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1613)
  18. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1550)
  19. ... 21 more

解决办法,指定hibernate.dialect即可:

1.如果配置文件格式为application.properties,在配置文件中添加以下代码即可:

spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect

2.如果配置文件格式为application.yml,则在JPA配置中添加以下代码:

database-platform: org.hibernate.dialect.MySQL5Dialect

Spring Boot下使用JPA报错:'hibernate.dialect' not set的解决办法

标签:sans   initial   database   eth   abstract   san   span   文件格式   term   

原文地址:https://www.cnblogs.com/LilLazy/p/14692590.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!