我有以下实体:
@Entity
class A {
@Id
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uuid2")
String id;
//some field
@ManyToMany
Set<B> other;
}
@Entity
class B {
@Id
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uuid2")
String id;
//some field
}
我想创建hql
查询,列出ids
中包含的A
实体的B Set<B>
。
Somethig喜欢(不正确):
select a.other.id from A as a where a.id = :pid
答案 0 :(得分:0)
尝试这样的事情:
select a.other.id from A a join a.other o where a.id = :pid