graphql:无法匹配类型定义(typename{name='long'})

3hvapo4f  于 2021-08-20  发布在  Java
关注(0)|答案(0)|浏览(225)

我正在使用springboot学习graphql,并尝试从这个链接中获取示例https://bezkoder.com/spring-boot-graphql-mysql-jpa/. 现在我遇到了一个问题,无法理解它为什么抛出这个错误。
有人能帮我指出我犯了什么错误吗?
错误: graphql.kickstart.tools.SchemaClassScannerError: Unable to match type definition (TypeName{name='Long'}) with java type (class java.lang.Long): No TypeDefinition for type name Long author.graphqls

type Author {
    id: ID!
    name: String!
    age: Int
}

# Root

type Query {
    findAuthorById(id: Long): Author!
    findAllAuthors: [Author]!
    countAuthors: Long!
}

# Root

type Mutation {
    createAuthor(name: String!, age: Int): Author!
}

author.java

@Entity
public class Author {
  @Id
  @GeneratedValue(strategy = GenerationType.AUTO)
  private Long id;

  @Column(name = "name", nullable = false)
  private String name;

  @Column(name = "age")
  private Integer age;

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题