@@ -59,13 +59,15 @@ public void addToQuery(AuditConfiguration auditCfg, String entityName, QueryBuil
59
59
60
60
CriteriaTools .checkPropertyNotARelation (auditCfg , entityName , propertyName );
61
61
62
+ // Make sure our conditions are ANDed together even if the parent Parameters have a different connective
63
+ Parameters subParams = parameters .addSubParameters (Parameters .AND );
62
64
// This will be the aggregated query, containing all the specified conditions
63
65
QueryBuilder subQb = qb .newSubQueryBuilder ();
64
66
65
67
// Adding all specified conditions both to the main query, as well as to the
66
68
// aggregated one.
67
69
for (AuditCriterion versionsCriteria : criterions ) {
68
- versionsCriteria .addToQuery (auditCfg , entityName , qb , parameters );
70
+ versionsCriteria .addToQuery (auditCfg , entityName , qb , subParams );
69
71
versionsCriteria .addToQuery (auditCfg , entityName , subQb , subQb .getRootParameters ());
70
72
}
71
73
@@ -79,6 +81,6 @@ public void addToQuery(AuditConfiguration auditCfg, String entityName, QueryBuil
79
81
}
80
82
81
83
// Adding the constrain on the result of the aggregated criteria
82
- parameters .addWhere (propertyName , "=" , subQb );
84
+ subParams .addWhere (propertyName , "=" , subQb );
83
85
}
84
86
}
0 commit comments