简体   繁体   English

如何从列表中查找所有链接的实体集合包含至少一个元素的所有实体?

[英]How to find all entities whose linked collection of entities contains at least one element from my list?

I want to find all entities Foo , whose Bar linked entities (via many-to-many relation) contains at least one element from my input Set . 我想找到所有实体Foo ,其Bar链接的实体(通过多对多关系)包含我输入Set至少一个元素。

@Override
public Set<Foo> findFoosHavingAtLeastOneBar(Set<Bar> bars) {
    QFoo foo = QFoo.foo;

    Predicate predicate = foo.bars. //I'm stuck here

}

When doing Ctrl + Space I can't find anything that could help me achieve this. 当执行Ctrl + Space时,我找不到任何可以帮助我实现这一目标的东西。

Is it possible to do that in a single Hibernate request? 是否可以在单个Hibernate请求中执行此操作?

您可以从输入栏中提取foo集,然后将所有foo集添加到另一个集中以删除重复项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 java API 查询那些数组类型字段包含给定数组的至少一个元素的所有实体? - How to query all entities those array type field contains at least one element of the given array using java API? 如何从实体集合中对属性中的实体列表进行排序 - How to sort a list of entities on the property from a collection of entities Java jpa:找到包含给定集合的每个元素的多对多属性的实体 - Java jpa: find entities with many to many property that contains every element of given collection Hibernate:选择其中包含所有指定值的实体 - Hibernate: Select entities where collection contains all of the specified valus 在实体集合中查找所有 id 集合的最有效方法 - Most efficient way to find the collection of all ids in a collection of entities 仅在Java中包含一个元素的情况下如何打印链接列表 - How to print Linked List only if it contains one element in Java 如何从休眠的一个表中获取实体列表? - How to get list of entities from one table away in hibernate? 断言该集合“包含至少一个非空元素” - Assert that collection “Contains at least one non-null element” 休眠如何将一个实体扩展到所有实体 - hibernate how to extend one entity to all the entities 如何将 ChangeHistory 添加到我的所有实体 - How to add a ChangeHistory to all of my entities
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM