当前位置: 首页 > 知识库问答 >
问题:

Spring JPArepository验证与查询方法

盖辉
2023-03-14

我在ClientRespository中实现此方法时遇到问题:

public interface ClientRepository extends JpaRepository<Client,Long> {
    @Query("select n from Client where n.nom like :x")
    public Page<Client> chercher(@Param("x") String mc , Pageable pageable);
}

Ex0019:启动Application ationContext时出错。要显示条件报告,请在启用调试的情况下重新运行您的应用程序。2018-05-23 10:33:32.606ERROR 15048 --- [ restartedMain]o.s.boot.SpringApplication:应用程序运行失败

org.springframework.beans.factory.创建名为maBanqueApplication的bean时出错:通过字段clientRepository表示的不满足依赖关系;嵌套异常是org.springframework.beans.factory.BeanCreationExc0019:创建名为clientRepository的bean时出错:调用init方法失败;嵌套异常是java.lang.IllegalArgumentExcoop:方法公共摘要org.springframework.data.domain.Pageorg.sid.的查询验证失败。ClientRepository.chercher客户端(java.lang.字符串,org.springframework.data.domain.分页)!在org.springframework.beans.factory.annotation.autowiredAnnotationBeanPostProcator$autowiredFieldElement.inject(autowiredAnnotationBeanPostProcessor.java:587)~[sping-bean-5.0.5。发布. jar: 5.0.5。RELEASE]在org.springframework.beans.factory.annotation.注入etadata.inject(注入etadata.java:91)~[Spring-bean-5.0.5.发布. jar: 5.0.5。发布]

共有1个答案

澹台华翰
2023-03-14

您的查询是错误的:

@Query("select n from Client where n.nom like :x") // You select `n` from no where

换成

@Query("select n from Client n where n.nom like :x")
 类似资料:
  • 问题内容: 我实现查询返回自定义对象中的输出。在执行过程中,出现错误: “方法公共抽象java.util.List org.degs.repository.ConsolidateresponseRepository.transactions()!” JPQL存储库代码: 豆: 如果我在mysql db终端中运行相同的查询,我已经在查询本身中处理了空值并获得了正常的输出,但是在JPA和Spring

  • 我正在尝试创建一个JPaRepository,代码如下,带有一个select查询和insert查询, 存储库代码: 实体代码: 但是插入查询中不断出现以下错误, 单独使用select查询可以很好地工作,但是当我添加insert查询时,会出现错误。我想不出问题出在哪里。

  • 我正在一个简单的Java程序中测试图-spqr天秤座。 这是我目前所做的: 然后,我在main方法中调用构建GraphQL方法 我有错误:查询无法验证:“{status(id:123){status}}” 怎么了?

  • 本文向大家介绍MongoDB查询性能优化验证及验证,包括了MongoDB查询性能优化验证及验证的使用技巧和注意事项,需要的朋友参考一下 结论: 1、 200w数据,合理使用索引的情况下,单个stationId下4w数据。mongodb查询和排序的性能理想,无正则时client可以在600ms+完成查询,qps300+。有正则时client可以在1300ms+完成查询,qps140+。 2、 Mon