Greggy
Greggy

Reputation: 719

JHipster EntityName_ cannot be resolved to a variable

I have strange problem with JHipster generated code - exacly in query services files. The problem looks like this:

EntityName_ cannot be resolved to a variable OtherEntityQueryService.java /project/src/main/java/com/example/project/service

Here is example where is this error located:

    if (criteria.getDescription() != null) {
        specification = specification.and(buildStringSpecification(criteria.getDescription(), EntityName_.description));
    }

This problem is not affecting building project, it is shown only in my IDE (Eclipse). But it is generating too many errors in IDE. Any ideas why it is shown as error?

Upvotes: 2

Views: 976

Answers (2)

Gert
Gert

Reputation: 176

To clearify the answer of Greggy:

  1. First run MVNW from the command prompt in the project folder
  2. (Then refresh the project in Eclipse)
  3. Go to the Java Build Path in the properties for the project
  4. Click "Add Folder" and select the target/generated-sources/annotations folder

Upvotes: 3

Greggy
Greggy

Reputation: 719

As I thought, this was a problem with my IDE, Eclipse. I had to add new source folder (link) to annotations directory. After this change, everything was fixed.

Upvotes: 0

Related Questions