2 years ago
#39006
Gumpf
Get Path data or Compare Elements of Path<List<X>> for Predicate
I am trying to construct a predicate that will succeed if any of the elements of a List
, referenced by a Path<List<X>>
, satisfy equality for one of the members of X
.
However, I cannot determine whether the data can be directly accessed. None of the methods I saw allow access to that data, and I cannot use the existing expression methods to do the above.
Here is code of what I'd like to be able to do, to do this comparison based on the y
attribute of the X
class:
List<X> xPredicates = new ArrayList<X>();
for(X x : this.getX()) {
for(X x2: m.get("xList").getActualList()) {
xPredicates.add(cb.like(x2.y, x.y));
}
}
Predicate actualPredicate = cb.or(xPredicates);
java
jpa
criteria-api
0 Answers
Your Answer