本文介绍了为什么Hibernate查询在IntelliJ中有编译错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  Query q = session.createQuery(from MyTable where status =:status) ; 

它编译并且工作正常..

但在IntelliJ我得到这个错误报告:

为什么IntelliJ抱怨??

解决方案


查看您项目中intelliJ中的hibernate配置部分。

如果它比帮助更困难,可能有办法将其关闭。

I have this Hibernate code:

Query q = session.createQuery("from MyTable where status = :status");

It compiles and works fine..

But in IntelliJ I get this error reported:

Why is IntelliJ complaining??

解决方案

IntelliJ is trying to validate your HQL query inside the string itself. To do this it needs to be configured to know about your hibernate configuration to ensure that a mapping exists for MyTable (it does at runtime, as you know - as it executes !).

Check out the hibernate config section in intelliJ for your project.

There is probably a way of turning it off if it is more hindrance than help.

这篇关于为什么Hibernate查询在IntelliJ中有编译错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 11:58