diff --git a/src/main/java/com/avaje/ebeaninternal/api/SpiQuery.java b/src/main/java/com/avaje/ebeaninternal/api/SpiQuery.java index dfcfa53a3..690a12058 100644 --- a/src/main/java/com/avaje/ebeaninternal/api/SpiQuery.java +++ b/src/main/java/com/avaje/ebeaninternal/api/SpiQuery.java @@ -3,6 +3,7 @@ package com.avaje.ebeaninternal.api; import java.util.ArrayList; import java.util.List; +import com.avaje.ebean.EbeanServer; import com.avaje.ebean.ExpressionList; import com.avaje.ebean.OrderBy; import com.avaje.ebean.PersistenceContextScope; @@ -148,6 +149,11 @@ public interface SpiQuery extends Query { */ SpiQuery copy(); + /** + * Return a copy of the query attaching to a different EbeanServer. + */ + SpiQuery copy(EbeanServer server); + /** * Return the type of query (List, Set, Map, Bean, rowCount etc). */ @@ -203,11 +209,6 @@ public interface SpiQuery extends Query { */ ManyWhereJoins getManyWhereJoins(); - /** - * Convert this natural key query into a find by id query. - */ - void convertWhereNaturalKeyToId(Object idValue); - /** * Return a Natural Key bind parameter if supported by this query. */ diff --git a/src/main/java/com/avaje/ebeaninternal/server/querydefn/DefaultOrmQuery.java b/src/main/java/com/avaje/ebeaninternal/server/querydefn/DefaultOrmQuery.java index ae88e8267..9fa53c56f 100644 --- a/src/main/java/com/avaje/ebeaninternal/server/querydefn/DefaultOrmQuery.java +++ b/src/main/java/com/avaje/ebeaninternal/server/querydefn/DefaultOrmQuery.java @@ -389,11 +389,6 @@ public class DefaultOrmQuery implements SpiQuery { select(beanDescriptor.getIdBinder().getIdProperty()); } - public void convertWhereNaturalKeyToId(Object idValue) { - whereExpressions = new DefaultExpressionList(this, null); - setId(idValue); - } - public NaturalKeyBindParam getNaturalKeyBindParam() { NaturalKeyBindParam namedBind = null; if (bindParams != null) { @@ -426,6 +421,10 @@ public class DefaultOrmQuery implements SpiQuery { } public DefaultOrmQuery copy() { + return copy(server); + } + + public DefaultOrmQuery copy(EbeanServer server) { // Not including these in the copy: // contextAdditions // queryListener