0 Replies Latest reply on Nov 16, 2017 3:28 PM by user551703

    Expression onyOf does not work correct when conforming results in UnitOfWork


      When testing Toplink 12c (eclipselink 2.5.2) I notice this behavior:


      I have three entities Employee(name), Customer(name) and Contact(Emp, daysVisited, Cus).

      Employee: Bob, Paul

      Customer: CompA, CompB

      Contacts: Con1 (Bob, 5 days, CompA), Con2 (Paul, 10 days, CompA), Con3 (Paul, 5 days, CompB).


      Assume the contacts are already read. Using query expression language with SHOULD_TRIGGER_INDIRECTION and conformResultsInUnitOfWork to query all employees visited customer CompA for 5 days, both employees Bob and Paul are in the resultset. That is wrong, only Bob ist right resultset.


      My expression is:

      ExpressionBuilder ebEmp = new ExpressionBuilder();

      Expression exprAnyOf = ebEmp.anyOf("contacts");

      Expression exp = exprAnyOf.get("customer").equal(compA).and(exprAnyOf.get("daysVisted").equal(5));


      To my mind the evaluation of the expression during conformResultsInUnitOfWork either does wrong or the expression is incorrect constructed.

      In LogicalExpression.doesConform (the .and()) the expression is split into two parts: 1) exprAnyOf.get("customer").equal(compA) && 2) exprAnyOf.get("daysVisted").equal(5). If the expression is ok, both parts may not be evaluated independently.


      If the expression is wrong, I have to create one like


      But how to? A Sub(Report)Query is not applicable because SHOULD_TRIGGER_INDIRECTION could not be set.


      Details and complete code are available at: https://bugs.eclipse.org/bugs/show_bug.cgi?id=526546


      Regard, Thorsten