[英]QueryService error while using Jhipster JDL
I used Jhipster to generate entities in my app.我使用 Jhipster 在我的应用程序中生成实体。 Here is jdl file content :
这是 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
Problem occurs in classes with suffix QueryService so GameGenreQueryService, GameQueryService and TournamentQueryService.问题出现在后缀为 QueryService 的类中,例如 GameGenreQueryService、GameQueryService 和 TournamentQueryService。 Issue occurs in method : createSpecification that Jhipster generate :
问题发生在 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_ cannot be resolved to a variable, Game_ cannot be resolved to a variable
Tournament_ 无法解析为变量,Game_ 无法解析为变量
I don't know what does this method expect but this is error that occur.我不知道这个方法期望什么,但这是发生的错误。 Is this my mistake on Jhipster ?
这是我在 Jhipster 上的错误吗?
Your project needs to compile to create meta-classes for your java-class specifications.您的项目需要编译才能为您的 java 类规范创建元类。
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:之后,要在 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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.