class A{
// one to many mapping
List<B> listOfB;
//getter and setter;
class B {
String s;
//getter and setter
}
现在,当我得到类 A 时,它将返回 listOfB 中所有关联的类 B。但我需要确定 B 中的哪一个应该做出回应。就像 Get A 这样 listOfB 包含所有这样的 B s = 'something'。
编辑:目前这不起作用:
select a from A a where a.listOfB IN (select b from a.listOfB b where b.s='something');