From 423b9acc47e05b6574e46665633352d8b42fea9a Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Thu, 16 Apr 2009 17:57:25 +0000 Subject: Combining queries which contain sub-filters should not share values among sub-elements. --- src/main/java/com/amazon/carbonado/qe/StandardQuery.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/amazon/carbonado/qe/StandardQuery.java b/src/main/java/com/amazon/carbonado/qe/StandardQuery.java index 736f31f..c86a5f3 100644 --- a/src/main/java/com/amazon/carbonado/qe/StandardQuery.java +++ b/src/main/java/com/amazon/carbonado/qe/StandardQuery.java @@ -163,7 +163,9 @@ public abstract class StandardQuery extends AbstractQuery if (getBlankParameterCount() > 0) { throw new IllegalStateException("Blank parameters exist in query: " + this); } - newFilter = mFilter.and(filter); + // Unbind is required to ensure sub-filters with common elements + // don't share values. + newFilter = mFilter.unbind().and(filter); newValues = newFilter.initialFilterValues(); if (mValues != null) { newValues = newValues.withValues(mValues.getSuppliedValues()); @@ -179,7 +181,9 @@ public abstract class StandardQuery extends AbstractQuery if (getBlankParameterCount() > 0) { throw new IllegalStateException("Blank parameters exist in query: " + this); } - Filter newFilter = mFilter.or(filter); + // Unbind is required to ensure sub-filters with common elements don't + // share values. + Filter newFilter = mFilter.unbind().or(filter); FilterValues newValues = newFilter.initialFilterValues(); if (mValues != null) { newValues = newValues.withValues(mValues.getSuppliedValues()); -- cgit v1.2.3