0

我使用 Jhipster 在我的应用程序中生成实体。这是jdl文件内容:

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

问题出现在后缀为 QueryService 的类中,例如 GameGenreQueryService、GameQueryService 和 TournamentQueryService。问题出现在方法中:Jhipster 生成的 createSpecification :

/**
     * 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_ 无法解析为变量,Game_ 无法解析为变量

我不知道这种方法期望什么,但这是发生的错误。这是我在 Jhipster 上的错误吗?

4

1 回答 1

0

您的项目需要编译为您的 java 类规范创建元类。

在这里你可以运行这个命令来创建:

./mvn clean compile

之后,要在 IntelliJ IDE 中定义元类,您需要在 maven Pom.xml 文件中添加此插件:

             <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>
于 2021-06-10T05:37:07.623 回答