简体   繁体   中英

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 .

@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.

Is it possible to do that in a single Hibernate request?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM