You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have developed a system that iteratively creates Criteria based on an account's configurations, and the resulting output generated by the system looks something like this:
Criteriacriteria = newCriteria("first").is("hello");
List<Criteria> criterias = newArrayList<>();
criterias.add(newCriteria().or("second").exists());
List<Criteria> subCriterias = newArrayList<>();
subCriterias.add(newCriteria("third").exists()
.and(newCriteria("fourth").is("ciao")));
subCriterias.add(newCriteria("third").exists()
.and(newCriteria("fourth").is("hi")));
Criteriaresult = Criteria.or();
for (Criteriac : criterias) {
result = result.or(c);
}
for (Criteriac : subCriterias) {
result = result.subCriteria(c);
}
criteria = criteria.subCriteria(result);
The issue is that in the subCriteria, I sometimes have to repeat "third-exists" in different subCriteria because one of them might not exist. This means I cannot optimize it into something like (third exists AND (fourth is "ciao" OR fourth is "hi")).
The main problem is that the hashCode() function only considers the first level, sees that both subCriteria start with "third-exists", and therefore decides not to add the second one to the subCriteria.
I am also attaching a test case in the CriteriaQueryMappingUnitTests class that reproduces this scenario.
I have developed a system that iteratively creates Criteria based on an account's configurations, and the resulting output generated by the system looks something like this:
The issue is that in the subCriteria, I sometimes have to repeat "third-exists" in different subCriteria because one of them might not exist. This means I cannot optimize it into something like (third exists AND (fourth is "ciao" OR fourth is "hi")).
The main problem is that the
hashCode()
function only considers the first level, sees that both subCriteria start with "third-exists", and therefore decides not to add the second one to the subCriteria.I am also attaching a test case in the
CriteriaQueryMappingUnitTests
class that reproduces this scenario.The text was updated successfully, but these errors were encountered: