我使用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上犯的错误吗?
答案 0 :(得分: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>