0
votes

I used Jhipster to generate entities in my app. Here is jdl file content :

entity GameGenre {
    name String
}

entity Game {
    name String,
    description String,
    coverImage String,
    logo String
}

entity Tournament {
}



// defining multiple OneToMany relationships with comments
relationship OneToMany {
    Game{tournaments} to Tournament
}

relationship ManyToMany {
    Game{genres} to GameGenre{games}
}


paginate Game with infinite-scroll
paginate GameGenre, Tournament with pagination

dto * with mapstruct

// Set service options to all except few
service all with serviceImpl

filter *

// Set an angular suffix
// angularSuffix * with mySuffix

Problem occurs in classes with suffix QueryService so GameGenreQueryService, GameQueryService and TournamentQueryService. Issue occurs in method : createSpecification that Jhipster generate :

/**
     * Function to convert TournamentCriteria to a {@link Specifications}
     */
    private Specifications<Tournament> createSpecification(TournamentCriteria criteria) {
        Specifications<Tournament> specification = Specifications.where(null);
        if (criteria != null) {
            if (criteria.getId() != null) {
                specification = specification.and(buildSpecification(criteria.getId(), Tournament_.id));
            }
            if (criteria.getGameId() != null) {
                specification = specification.and(buildReferringEntitySpecification(criteria.getGameId(), Tournament_.game, Game_.id));
            }
        }
        return specification;
    }

Tournament_ cannot be resolved to a variable, Game_ cannot be resolved to a variable

I don't know what does this method expect but this is error that occur. Is this my mistake on Jhipster ?

1
Does the project compile? Are those errors from the IDE? You may need to configure it to load those classes docs.jboss.org/hibernate/orm/current/topical/html_single/…Jon Ruddell
It works now. Can you help me regarding : stackoverflow.com/questions/51565096/… ?user3364181

1 Answers

0
votes

Your project needs to compile to create meta-classes for your java-class specifications.

Here you can run this command to create:

./mvn clean compile

after that, for defining your metaclasses in your IntelliJ IDE you need to add this plugin in your maven, Pom.xml file:

             <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.2.0</version>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <phase>generate-sources</phase>
                        <configuration>
                            <sources>
                                <source>target/generated-sources/annotations</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>