entityName_ 无法解析为变量,eclipse 中的错误消息 ide?

entityName_ cannot be resolved to a variable, error message in eclipse ide?

在我的 Jhipster 生成的文件 entityNameQueryService.java 中,eclipse 将以下行指示为错误,但项目编译成功。 所以,这一定是eclipse的配置问题ide。自己想不通..

        if (criteria.getId() != null) {
            specification = specification.and(buildSpecification(criteria.getId(), FRCommunications_.id));
        }

错误信息是

"FRCommunications_ cannot be resolved to a variable"

供您参考,FRCommunications 是我的实体名称。

有人解决这个问题吗?

JHipster 中用于 JPA 过滤的 JPA 静态元模型需要在构建时通过注解处理器生成 类(命名为实体但后缀为“_”),这是为 maven 和 gradle 所以你可以 运行 一个构建,它会生成缺失的 类。

或者,如果您不想使用 Maven 或 gradle 构建,请参阅 https://docs.jboss.org/hibernate/orm/5.0/topical/html/metamodelgen/MetamodelGenerator.html#_eclipse

对于eclipse,在

之后

mvn clean install -nsu

只需右键单击 target/generated-sources/annotation 和 select "Use as Source Folder"