【问题标题】:jpa using a collection as a parameter for a IsContainingIgnoreCase query methodjpa 使用集合作为 IsContainingIgnoreCase 查询方法的参数
【发布时间】:2019-02-06 17:49:36
【问题描述】:

是否可以使用 List 对象作为 jpa 查询方法的参数,如下所示

List<String> aList = new ArrayList<>();
aList.add("test"); //and pretend there is a few more elements in the list.
repository.countDistinctByTitleIsContainingIgnoreCase(aList);

其中方法定义为:

int countDistinctByTitleIsContainingIgnoreCase(List<String> aList)

这里是查询方法中的一些附加信息

https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#jpa.query-methods

【问题讨论】:

    标签: java spring-data-jpa


    【解决方案1】:

    不,这是不可能的。你可以做的是,使用Specification 来组装你的 where 条件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-02-24
      • 2011-03-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-10
      • 1970-01-01
      相关资源
      最近更新 更多