idea hibernate console 执行hql报错

报错信息

hql> select a from GDXMZD a
[2019-08-29 13:45:01] org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
[2019-08-29 13:45:01] java.lang.RuntimeException: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
[2019-08-29 13:45:01] at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:100)
[2019-08-29 13:45:01] at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:54)
[2019-08-29 13:45:01] at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:137)
[2019-08-29 13:45:01] at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)

 1 首先检查实体是否关联了数据源

2 检查数据库是否连接

3 检查application.yaml 或配置文件中是否配置了hibernate方言

postgresql

dialect: org.hibernate.dialect.PostgreSQL95Dialect

 4 其他问题

参考:

1  https://www.jetbrains.com/help/idea/working-with-the-persistence-tool-window.html#assign_data_source

 2 https://intellij-support.jetbrains.com/hc/en-us/community/posts/360001876979-JPA-Console-hibernate-dialect-not-set-error-during-a-query-to-Sql-Server-table

原文地址:https://www.cnblogs.com/wolbo/p/11429469.html