【问题标题】:QueryDSL over collections -> any() for a List of StringsQueryDSL over collections -> any() 用于字符串列表
【发布时间】:2015-09-21 14:50:53
【问题描述】:

我正在尝试在集合上使用 querydsl。 我的名单是List<String>

第一个问题,是否可以在 primitive 类型集合上使用 querydsl? 此后,我如何构建一个查询,例如:give all strings which there aren't in list x

我试过这个:

String digitalResourceId;
for (String resource : from(digitalResourceId, digitalResourceIds)
                            .where(fua.getResources().any().eq(digitalResourceId))
                            .list(digitalResourceId)){
        System.out.println(resource);
    }

但是我在any() 方法上编译了问题:

The method any() is undefined for the type List<String>

【问题讨论】:

    标签: java collections querydsl jooq


    【解决方案1】:
    List<String> x = ...
    List<String> output = queryFactory.selectFrom(resource_table.resourceId)
        .where(resource_table.resourceId.notIn(x))
        .fetch();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-10-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-30
      • 1970-01-01
      相关资源
      最近更新 更多