次のようなクラス構造があるとします (注釈は削除されています)。
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 であるか、その color 属性が null である可能性があります (どちらの場合も、Person と同じストアを持つすべてのペイントを返します)。
paints コレクションでこのクエリを構築する JPA または Hibernate ベースのアノテーションはありますか?