Let's say I have 2 classes defined this way
class A{
private String name;
}
class B{
private A a;
private String bla;
}
And also have predicates for A and B, like this
public static Specification<A> hasName(String name) {
return (a, cq, cb) -> {
return cb.and(a.get("name").in(name));
};
}
and
public static Specification<B> hasBla(String bla) {
return (b, cq, cb) -> {
return cb.and(b.get("bla").in(bla));
};
}
Having that both predicates are for different classes, is there a way to use both in the same query? for example, get elements that have the matching name and bla