【发布时间】:2018-10-07 03:31:26
【问题描述】:
我收到以下信息,但似乎找不到答案。
Error [ValidationError{validationErrorType=FieldUndefined, queryPath=[find_by_id], message=Validation error of type FieldUndefined: Field 'find_by_id' in type 'Query' is undefined @ 'find_by_id', locations=[SourceLocation{line=1, column=2}], description='Field 'find_by_id' in type 'Query' is undefined'}]
我的代码。
查询
@GraphQLQuery(name = "find_by_id")
public Event findById(@GraphQLArgument(name = "id") Long id) {
架构生成
@EJB
private EventFacade eventFacade; // Normal stateless bean
GraphQLSchema guestSchema = new GraphQLSchemaGenerator()
.withOperationsFromSingleton(eventFacade)
.withValueMapperFactory(new JacksonValueMapperFactory())
.withDefaults()
.generate();
GraphQL graphQL = GraphQL.newGraphQL(guestSchema).build();
要执行的代码
String query = "{find_by_id (id: 1){eventName}}";
ExecutionResult result = graphQL.execute(query);
使用SPQR 库
事件 POJO 是基本的事件名称,它是一个字符串,一个来自抽象(父)类的 id。实体类在不同的 jar (Entity Jar) 中。执行查询和构建模式的代码在 EJB Jar 中。
任何我出错的帮助/指示将不胜感激。
更新 创建了一个git问题来帮助解决Git Issue
【问题讨论】:
标签: java graphql graphql-java graphql-spqr