Fix RSQL G2 visitor and referenes (e.g. assignedds) with multiple conditions (2) (#2406)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2025-05-16 15:11:25 +03:00
committed by GitHub
parent 86fca64e51
commit c0e89fbbee
2 changed files with 14 additions and 4 deletions

View File

@@ -298,8 +298,13 @@ public class JpaQueryRsqlVisitorG2<A extends Enum<A> & RsqlQueryField, T>
if (!attribute.isCollection()) {
// it is a SingularAttribute and not join if it is of basic or entity persistence type
final Type.PersistenceType persistenceType = ((SingularAttribute<?, ?>) attribute).getType().getPersistenceType();
if (persistenceType.equals(Type.PersistenceType.BASIC) || persistenceType.equals(Type.PersistenceType.ENTITY)) {
if (persistenceType == Type.PersistenceType.BASIC) {
return root.get(fieldNameSplit);
} else if (persistenceType == Type.PersistenceType.ENTITY) {
return root.getJoins().stream()
.filter(join -> join.getAttribute().equals(attribute))
.findFirst()
.orElseGet(() -> root.join(fieldNameSplit, JoinType.LEFT));
}
} // if a collection - it is a join
if (inOr && root == this.root) { // try to reuse join of the same "or" level and no subquery