如果我有一个如下所示的类结构(已删除注释):
public class Person {
String store;
Swatch swatch;
Collection<Paint> paints;
}
public class Swatch {
String color;
}
public class Paint {
String color;
String store;
}
Store 永远不会为 null,它是 Person 和 Paint 之间使用的键。目标是匹配与 Swatch 具有相同颜色的所有 Paint 记录与与 Person 相同的存储。但是,Swatch 可能为 null 或其颜色属性可能为 null(在这两种情况下都返回与 Person 具有相同存储的所有 Paint)。
是否有基于 JPA 或 Hibernate 的注释将在绘画集合上构造此查询?