1
如果我有一类结构如下所示(注释去掉):如何用Hibernate注释有条件地映射集合?
public class Person {
String store;
Swatch swatch;
Collection<Paint> paints;
}
public class Swatch {
String color;
}
public class Paint {
String color;
String store;
}
店是从来没有空,是人与涂料之间使用的密钥。我们的目标是将所有Paint记录与具有与Person相同商店的Swatch相同的颜色进行匹配。但是,Swatch可能为null,或者其颜色属性可能为null(在两种情况下都会返回与Person具有相同商店的所有Paints)。
是否有JPA或Hibernate基于注解,将构建在油漆收集此查询?
这听起来更像是您应该构建的查询的工作。 –