@@ -130,6 +130,7 @@ private static void definesCondition(CriteriaCondition condition,
130130                                         char  entity , int  counter ) {
131131
132132        Element  document  = condition .element ();
133+         int  localCounter  = counter ;
133134        switch  (condition .condition ()) {
134135            case  IN :
135136                appendCondition (aql , params , entity , document , IN );
@@ -157,27 +158,26 @@ private static void definesCondition(CriteriaCondition condition,
157158                for  (CriteriaCondition  dc  : document .get (new  TypeReference <List <CriteriaCondition >>() {
158159                })) {
159160
160-                     if  (isFirstCondition (aql , counter )) {
161+                     if  (isFirstCondition (aql , localCounter )) {
161162                        aql .append (AND );
162163                    }
163-                     definesCondition (dc , aql , params , entity , ++counter );
164+                     definesCondition (dc , aql , params , entity , ++localCounter );
164165                }
165166                return ;
166167            case  OR :
167168
168169                for  (CriteriaCondition  dc  : document .get (new  TypeReference <List <CriteriaCondition >>() {
169170                })) {
170-                     if  (isFirstCondition (aql , counter )) {
171+                     if  (isFirstCondition (aql , localCounter )) {
171172                        aql .append (OR );
172173                    }
173-                     definesCondition (dc , aql , params , entity , ++counter );
174+                     definesCondition (dc , aql , params , entity , ++localCounter );
174175                }
175176                return ;
176177            case  NOT :
177178                CriteriaCondition  documentCondition  = document .get (CriteriaCondition .class );
178-                 aql .append (NOT );
179-                 aql .append (START_EXPRESSION );
180-                 definesCondition (documentCondition , aql , params , entity , ++counter );
179+                 aql .append (NOT ).append (START_EXPRESSION );
180+                 definesCondition (documentCondition , aql , params , entity , ++localCounter );
181181                aql .append (END_EXPRESSION );
182182                return ;
183183            default :
0 commit comments