com.avaje.ebeaninternal.api.SpiQuery Maven / Gradle / Ivy
package com.avaje.ebeaninternal.api;
import com.avaje.ebean.EbeanServer;
import com.avaje.ebean.ExpressionList;
import com.avaje.ebean.OrderBy;
import com.avaje.ebean.PersistenceContextScope;
import com.avaje.ebean.Query;
import com.avaje.ebean.bean.BeanCollectionTouched;
import com.avaje.ebean.bean.CallStack;
import com.avaje.ebean.bean.ObjectGraphNode;
import com.avaje.ebean.bean.PersistenceContext;
import com.avaje.ebean.event.BeanQueryRequest;
import com.avaje.ebean.event.readaudit.ReadEvent;
import com.avaje.ebean.plugin.BeanType;
import com.avaje.ebeaninternal.server.autotune.ProfilingListener;
import com.avaje.ebeaninternal.server.deploy.BeanDescriptor;
import com.avaje.ebeaninternal.server.deploy.BeanPropertyAssocMany;
import com.avaje.ebeaninternal.server.deploy.TableJoin;
import com.avaje.ebeaninternal.server.query.CancelableQuery;
import com.avaje.ebeaninternal.server.querydefn.NaturalKeyBindParam;
import com.avaje.ebeaninternal.server.querydefn.OrmQueryDetail;
import java.sql.Timestamp;
import java.util.List;
import java.util.Set;
/**
* Object Relational query - Internal extension to Query object.
*/
public interface SpiQuery extends Query {
enum Mode {
NORMAL(false), LAZYLOAD_MANY(false), LAZYLOAD_BEAN(true), REFRESH_BEAN(true);
Mode(boolean loadContextBean) {
this.loadContextBean = loadContextBean;
}
private final boolean loadContextBean;
public boolean isLoadContextBean() {
return loadContextBean;
}
}
/**
* The type of query result.
*/
enum Type {
/**
* Find by Id or unique returning a single bean.
*/
BEAN,
/**
* Find iterate type query - findEach(), findIterate() etc.
*/
ITERATE,
/**
* Find returning a List.
*/
LIST,
/**
* Find returning a Set.
*/
SET,
/**
* Find returning a Map.
*/
MAP,
/**
* Find the Id's.
*/
ID_LIST,
/**
* Find rowCount.
*/
ROWCOUNT,
/**
* A subquery used as part of a where clause.
*/
SUBQUERY,
/**
* Delete query.
*/
DELETE,
}
enum TemporalMode {
/**
* Includes soft deletes rows in the result.
*/
SOFT_DELETED,
/**
* Query runs against draft tables.
*/
DRAFT,
/**
* Query runs against current data (normal).
*/
CURRENT,
/**
* Query runs potentially returning many versions of the same bean.
*/
VERSIONS,
/**
* Query runs 'As Of' a given date time.
*/
AS_OF;
/**
* Return the mode of the query of if null return CURRENT mode.
*/
public static TemporalMode of(SpiQuery> query) {
return (query != null) ? query.getTemporalMode() : TemporalMode.CURRENT;
}
}
/**
* Return true if AutoTune should be attempted on this query.
*/
boolean isAutoTunable();
/**
* Return the bean descriptor for this query.
*/
BeanDescriptor getBeanDescriptor();
/**
* Return true if this query should be executed against the doc store.
*/
boolean isUseDocStore();
/**
* Return the PersistenceContextScope that this query should use.
*
* This can be null and in that case use the default scope.
*
*/
PersistenceContextScope getPersistenceContextScope();
/**
* Return the default lazy load batch size.
*/
int getLazyLoadBatchSize();
/**
* Return true if select all properties was used to ensure the property
* invoking a lazy load was included in the query.
*/
boolean selectAllForLazyLoadProperty();
/**
* Set the query mode.
*/
void setMode(Mode m);
/**
* Return the query mode.
*/
Mode getMode();
/**
* Return the Temporal mode for the query.
*/
TemporalMode getTemporalMode();
/**
* Return true if this is a find versions between query.
*/
boolean isVersionsBetween();
/**
* Return the find versions start timestamp.
*/
Timestamp getVersionStart();
/**
* Return the find versions end timestamp.
*/
Timestamp getVersionEnd();
/**
* Return true if this is a 'As Of' query.
*/
boolean isAsOfQuery();
/**
* Return true if this is a 'As Draft' query.
*/
boolean isAsDraft();
/**
* Return true if this query includes soft deleted rows.
*/
boolean isIncludeSoftDeletes();
/**
* Return the asOf Timestamp which the query should run as.
*/
Timestamp getAsOf();
/**
* Add a table alias for a @History entity involved in a 'As Of' query.
*/
void addAsOfTableAlias(String tableAlias);
/**
* Return the list of table alias involved in a 'As Of' query that have @History support.
*/
List getAsOfTableAlias();
void addSoftDeletePredicate(String softDeletePredicate);
List getSoftDeletePredicates();
/**
* Return a listener that wants to be notified when the bean collection is
* first used.
*/
BeanCollectionTouched getBeanCollectionTouched();
/**
* Set a listener to be notified when the bean collection has been touched
* (when the list/set/map is first used).
*/
void setBeanCollectionTouched(BeanCollectionTouched notify);
/**
* Set the list of Id's that is being populated.
*
* This is a mutating list of id's and we are setting this so that other
* threads have access to the id's before the id query has finished.
*
*/
void setIdList(List