mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
FIX: Pairs must not be modified by query (#1539)
* FIX: Pairs must not be modified by query * Modification can also occur on inValues. * fixed tests * removed obsolete line
This commit is contained in:
committed by
Rob Bygrave
parent
01d9dd3fe8
commit
105f08cca1
@@ -1,6 +1,7 @@
|
||||
package io.ebeaninternal.server.expression;
|
||||
|
||||
import io.ebean.Pairs;
|
||||
import io.ebean.Pairs.Entry;
|
||||
import io.ebean.event.BeanQueryRequest;
|
||||
import io.ebeaninternal.api.NaturalKeyQueryData;
|
||||
import io.ebeaninternal.api.SpiExpression;
|
||||
@@ -15,11 +16,9 @@ class InPairsExpression extends AbstractExpression {
|
||||
|
||||
private final boolean not;
|
||||
|
||||
private final Pairs pairs;
|
||||
|
||||
private final String property0, property1;
|
||||
|
||||
private final List<Pairs.Entry> entries;
|
||||
private List<Pairs.Entry> entries;
|
||||
|
||||
private boolean multiValueSupported;
|
||||
|
||||
@@ -31,9 +30,9 @@ class InPairsExpression extends AbstractExpression {
|
||||
|
||||
InPairsExpression(Pairs pairs, boolean not) {
|
||||
super(pairs.getProperty0());
|
||||
this.pairs = pairs;
|
||||
this.property0 = pairs.getProperty0();
|
||||
this.property1 = pairs.getProperty1();
|
||||
// the entries might be modified on cache hit.
|
||||
this.entries = pairs.getEntries();
|
||||
this.not = not;
|
||||
this.separator = pairs.getConcatSeparator();
|
||||
@@ -42,7 +41,15 @@ class InPairsExpression extends AbstractExpression {
|
||||
|
||||
@Override
|
||||
public boolean naturalKey(NaturalKeyQueryData<?> data) {
|
||||
return !not && data.matchInPairs(pairs);
|
||||
if (not) {
|
||||
return false;
|
||||
}
|
||||
List<Entry> copy = data.matchInPairs(property0, property1, entries);
|
||||
if (copy == null) {
|
||||
return false;
|
||||
}
|
||||
entries = copy;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user