Skip to content

Commit

Permalink
fix not equal operator
Browse files Browse the repository at this point in the history
  • Loading branch information
vietnguyen committed Nov 19, 2024
1 parent c57bff7 commit 9048c64
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
package org.hisp.dhis.query.operators;

import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.Join;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import org.hibernate.criterion.Criterion;
Expand Down Expand Up @@ -64,6 +65,13 @@ public <Y> Predicate getPredicate(CriteriaBuilder builder, Root<Y> root, QueryPa

return builder.notEqual(builder.size(root.get(queryPath.getPath())), value);
}
if (queryPath.haveAlias()) {
for (Join<Y, ?> join : root.getJoins()) {
if (join.getAlias().equals(queryPath.getAlias()[0])) {
return builder.equal(join.get(queryPath.getProperty().getFieldName()), args.get(0));
}
}
}
return builder.notEqual(root.get(queryPath.getPath()), args.get(0));
}

Expand Down

0 comments on commit 9048c64

Please sign in to comment.