【发布时间】:2019-08-31 15:09:25
【问题描述】:
我尝试使用 spring boot JPA 和 CRUD Repository findAll() 方法从数据库中获取数据,并使用 not in 子句,但找不到任何位置。有任何使用 findAll() 方法进行动态查询的解决方案。
示例:
hql="select * from urlMaster urlmast where urlmast.urlcd not in (select distinct acturl.acuCd from ActionUrl acturl) order by urlmast.urlcd";
目前我只是从 urlMaster 数据中获取数据。但我想要 acturl.acuCd not in ActionUrl 表。
存储库类:
public interface ActionUrlRepository extends CrudRepository<urlMaster, Long>,JpaRepository<urlMaster, Long> {
}
服务实现:
actionurlrepository.findAll();
如果有什么规定?请指导我。谢谢!
【问题讨论】:
-
为什么
findAll()会限制结果?我想我不明白你的问题。 -
Jens Schauder!- 我想要基于豪宅查询的数据库中的数据。 Springboot 已经有一些预定义的方法,如 findAll()...等以及 springboot 中的各种存储库。同样,我将根据带有 not in 子句的 that 方法构建标准。如果你有什么解决办法?让我们发布。我知道@Query 已经有了。我正在寻找那种情况。一些互联网指南告诉解决方案,但没有得到确切的解决方案。-谢谢
标签: java spring spring-boot jpa spring-data-jpa