我在扩展JPA的存储库中有一个方法-> findByfileNameLike(fileName,1, pageable)及其声明
@Query(value = QUERY)
@Transactional(propagation = Propagation.REQUIRED, readOnly = true)
@LogExecutionTime
Page<BatchDTO> findByfileNameLike(String
fileName,@Param("departmentId")Integer departmentId, Pageable pageable)查询是Select new DTO(bdm.id.batch.status) from Table bdm where bdm.id.departmentId =:departmentId and bdm.id.batch.status <> 7";
我想通过列FileName来过滤查询,我已经按照spring数据jpa.But的文档给出了方法名,它不起作用。我将如何给出要过滤的fileName ?它应该是方法中的第一个参数吗?
发布于 2019-02-01 10:15:05
使用注释@Query指定查询之后,Spring将不会根据方法名称自动为您创建查询,它将依赖于使用注释提供的查询。在这里,findByfileNameLike方法不会产生任何不同,因为查询是显式提供的。希望这能回答你的问题
https://stackoverflow.com/questions/54476219
复制相似问题