IntelliJ IDEA使用“无法解析符号”突出显示@Entity类名称在JPQL中 [英] IntelliJ IDEA highlights @Entity class names with "Cannot resolve symbol" in JPQL

查看:647
本文介绍了IntelliJ IDEA使用“无法解析符号”突出显示@Entity类名称在JPQL中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

IntelliJ IDEA突出显示持久的@Entity类名称,JPQL中的无法解析符号为红色,这会分散注意力并掩盖实际问题。

IntelliJ IDEA highlights persistent @Entity class names with "Cannot resolve symbol" in red in JPQL which is distracting and buries real issues.

因此,例如,我在我的存储库中声明了一个查询:

So, for example, I declare a query in my repository:

private static final String READ_BY_CANDIDATE_KEY = "SELECT cr FROM Entity AS cr left join cr.relationship AS re left join fetch cr.relationship2 WHERE re.candidateKey=:ID";

..并且实体带有下划线,即使实体是有效的类名,并且有@Entity注释。当代码实际运行时,没有问题。

.. and "Entity" is underlined, even though "Entity" is a valid class name, and has the @Entity annotation. When the code actually runs, there are no problems.

我想让IDE知道什么类有效需要某种配置?该配置是如何完成的?

I imagine some sort of configuration is required to let the IDE know what classes are valid? How is that configuration done?

更新:我确实有一个JPA方面,但它没有看到带注释的类。它似乎需要一个persistence.xml或orm.xml(我的项目不使用)

Update: I do have a JPA facet, but it doesn't see the annotated classes. It seems to require a persistence.xml or orm.xml (which my project does not use)

推荐答案

好像你没有在构面配置中选择了默认的JPA提供程序。根据您使用的提供商,从列表中选择一个。可用选项包括EclipseLink,Hibernate,OpenJPA,TopLink

Seems like you have not selected the default JPA provider in facet configuration. Depending upon which provider you are using, pick one from the list. Available options are EclipseLink, Hibernate, OpenJPA, TopLink

这篇关于IntelliJ IDEA使用“无法解析符号”突出显示@Entity类名称在JPQL中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆