/** * INTERNAL: * Override Expression.registerIn to check if the new base expression * has already been provided for the clone. * @see oracle.toplink.essentials.expressions.Expression#cloneUsing(Expression) * @bug 2637484 INVALID QUERY KEY EXCEPTION THROWN USING BATCH READS AND PARALLEL EXPRESSIONS */ protected Expression registerIn(Dictionary alreadyDone) { // Here do a special check to see if this a cloneUsing(newBase) call. Object value = alreadyDone.get(alreadyDone); if ((value == null) || (value == alreadyDone)) { // This is a normal cloning operation. return super.registerIn(alreadyDone); } ObjectExpression copy = (ObjectExpression)value; // copy is actually the newBase of a cloneUsing. alreadyDone.put(alreadyDone, alreadyDone); alreadyDone.put(this, copy); // Now need to copy over the derived expressions, etc. if (this.derivedExpressions != null) { if (copy.derivedExpressions == null) { copy.derivedExpressions = copyCollection(this.derivedExpressions, alreadyDone); } else { copy.derivedExpressions.addAll(copyCollection(this.derivedExpressions, alreadyDone)); } } // Do the same for these protected fields. copy.postCopyIn(alreadyDone, this.derivedFields, this.derivedTables); return copy; }