public static class Model.Finder<I,T>
extends java.lang.Object
Constructor and Description |
---|
Model.Finder(java.lang.Class<I> idType,
java.lang.Class<T> type)
Creates a finder for entity of type
T with ID of type I . |
Model.Finder(java.lang.String serverName,
java.lang.Class<I> idType,
java.lang.Class<T> type)
Creates a finder for entity of type
T with ID of type I , using a specific Ebean server. |
Modifier and Type | Method and Description |
---|---|
java.util.List<T> |
all()
Retrieves all entities of the given type.
|
T |
byId(I id)
Retrieves an entity by ID.
|
void |
cancel()
Cancels query execution, if supported by the underlying database and driver.
|
|
copy()
Copies this query.
|
|
fetch(java.lang.String path)
Specifies a path to load including all its properties.
|
|
fetch(java.lang.String path,
FetchConfig joinConfig)
Additionally specifies a
JoinConfig to specify a 'query join' and/or define the lazy loading query. |
|
fetch(java.lang.String path,
java.lang.String fetchProperties)
Specifies a path to fetch with a specific list properties to include, to load a partial object.
|
|
fetch(java.lang.String assocProperty,
java.lang.String fetchProperties,
FetchConfig fetchConfig)
Additionally specifies a
FetchConfig to use a separate query or lazy loading to load this path. |
|
filter()
Creates a filter for sorting and filtering lists of entities locally without going back to the database.
|
|
filterMany(java.lang.String propertyName)
Applies a filter on the 'many' property list rather than the root level objects.
|
|
findFutureIds()
Executes a find IDs query in a background thread.
|
|
findFutureList()
Executes a find list query in a background thread.
|
|
findFutureRowCount()
Executes a find row count query in a background thread.
|
java.util.List<java.lang.Object> |
findIds()
Executes a query and returns the results as a list of IDs.
|
|
findIterate() |
java.util.List<T> |
findList()
Executes the query and returns the results as a list of objects.
|
java.util.Map<?,T> |
findMap()
Executes the query and returns the results as a map of objects.
|
<K> java.util.Map<K,T> |
findMap(java.lang.String a,
java.lang.Class<K> b)
Executes the query and returns the results as a map of the objects.
|
|
findPagingList(int pageSize)
Returns a
PagingList for this query. |
int |
findRowCount()
Returns the number of entities this query should return.
|
java.util.Set<T> |
findSet()
Executes the query and returns the results as a set of objects.
|
T |
findUnique()
Executes the query and returns the results as either a single bean or
null , if no matching bean is found. |
void |
findVisit( |
ExpressionFactory |
getExpressionFactory()
Returns the
ExpressionFactory used by this query. |
int |
getFirstRow()
Returns the first row value.
|
java.lang.String |
getGeneratedSql()
Returns the SQL that was generated for executing this query.
|
int |
getMaxRows()
Returns the maximum of rows for this query.
|
RawSql |
getRawSql()
Returns the
RawSql that was set to use for this query. |
int |
getTotalHits()
Return the total hits matched for a lucene text search query.
|
UseIndex |
getUseIndex() |
|
having()
Returns the query's
having clause. |
|
having(com.avaje.ebean.Expression addExpressionToHaving)
Adds an expression to the
having clause and returns the query. |
|
having(java.lang.String addToHavingClause)
Adds clauses to the
having clause and returns the query. |
boolean |
isAutofetchTuned()
Returns
true if this query was tuned by autoFetch . |
boolean |
isForUpdate()
Whether this query is for update
|
I |
nextId()
Returns the next identity value.
|
Model.Finder<I,T> |
on(java.lang.String server)
Changes the Ebean server.
|
|
order()
Returns the
order by clause so that you can append an ascending or descending property to the order by clause. |
|
order(java.lang.String orderByClause)
Sets the
order by clause, replacing the existing order by clause if there is one. |
|
orderBy()
Returns the
order by clause so that you can append an ascending or descending property to the order by clause. |
|
orderBy(java.lang.String orderByClause)
Set the
order by clause replacing the existing order by clause if there is one. |
|
query()
Creates a query.
|
T |
ref(I id)
Retrieves an entity reference for this ID.
|
|
select(java.lang.String fetchProperties)
Explicitly sets a comma delimited list of the properties to fetch on the 'main' entity bean, to load a partial object.
|
|
setAutofetch(boolean autofetch)
Explicitly specifies whether to use 'Autofetch' for this query.
|
|
setBackgroundFetchAfter(int backgroundFetchAfter)
Sets the rows after which fetching should continue in a background thread.
|
|
setBufferFetchSizeHint(int fetchSize)
Sets a hint, which for JDBC translates to
Statement.fetchSize() . |
|
setDistinct(boolean isDistinct)
Sets whether this query uses
DISTINCT . |
|
setFirstRow(int firstRow)
Sets the first row to return for this query.
|
|
setForUpdate(boolean forUpdate)
Execute the select with "for update" which should lock the record "on read"
|
|
setId(java.lang.Object id)
Sets the ID value to query.
|
|
setListener(
Sets a listener to process the query on a row-by-row basis.
|
|
setLoadBeanCache(boolean loadBeanCache)
When set to
true , all the beans from this query are loaded into the bean cache. |
|
setMapKey(java.lang.String mapKey)
Sets the property to use as keys for a map.
|
|
setMaxRows(int maxRows)
Sets the maximum number of rows to return in the query.
|
|
setOrder(
Replaces any existing
order by clause using an OrderBy object. |
|
setOrderBy(
Set an OrderBy object to replace any existing
order by clause. |
|
setParameter(int position,
java.lang.Object value)
Sets an ordered bind parameter according to its position.
|
|
setParameter(java.lang.String name,
java.lang.Object value)
Sets a named bind parameter.
|
|
setQuery(java.lang.String oql)
Sets the OQL query to run
|
|
setRawSql(RawSql rawSql)
Sets
RawSql to use for this query. |
|
setReadOnly(boolean readOnly)
Sets whether the returned beans will be read-only.
|
|
setTimeout(int secs)
Sets a timeout on this query.
|
|
setUseCache(boolean useBeanCache)
Sets whether to use the bean cache.
|
|
setUseIndex(UseIndex useIndex) |
|
setUseQueryCache(boolean useQueryCache)
Sets whether to use the query cache.
|
|
setVanillaMode(boolean vanillaMode)
Sets whether to use 'vanilla mode', in which the returned beans and collections will be plain classes rather than Ebean-generated dynamic subclasses etc.
|
|
where()
Adds expressions to the
where clause with the ability to chain on the ExpressionList . |
|
where(com.avaje.ebean.Expression expression)
Adds a single
Expression to the where clause and returns the query. |
|
where(java.lang.String addToWhereClause)
Adds additional clauses to the
where clause. |
public Model.Finder(java.lang.Class<I> idType, java.lang.Class<T> type)
T
with ID of type I
.public Model.Finder<I,T> on(java.lang.String server)
public java.util.List<T> all()
publicfilter()
publicquery()
public I nextId()
public void cancel()
publiccopy()
publicfetch(java.lang.String path)
publicfetch(java.lang.String path, FetchConfig joinConfig)
JoinConfig
to specify a 'query join' and/or define the lazy loading query.publicfetch(java.lang.String path, java.lang.String fetchProperties)
publicfetch(java.lang.String assocProperty, java.lang.String fetchProperties, FetchConfig fetchConfig)
FetchConfig
to use a separate query or lazy loading to load this path.publicfilterMany(java.lang.String propertyName)
publicfindFutureIds()
publicfindFutureList()
publicfindFutureRowCount()
public java.util.List<java.lang.Object> findIds()
public java.util.List<T> findList()
public java.util.Map<?,T> findMap()
public <K> java.util.Map<K,T> findMap(java.lang.String a, java.lang.Class<K> b)
publicfindPagingList(int pageSize)
PagingList
for this query.public int findRowCount()
public java.util.Set<T> findSet()
public T findUnique()
null
, if no matching bean is found.public void findVisit(visitor)
publicfindIterate()
public ExpressionFactory getExpressionFactory()
ExpressionFactory
used by this query.public int getFirstRow()
public java.lang.String getGeneratedSql()
public int getMaxRows()
public RawSql getRawSql()
RawSql
that was set to use for this query.public UseIndex getUseIndex()
publichaving()
having
clause.publichaving(com.avaje.ebean.Expression addExpressionToHaving)
having
clause and returns the query.publichaving(java.lang.String addToHavingClause)
having
clause and returns the query.public boolean isAutofetchTuned()
true
if this query was tuned by autoFetch
.publicorder()
order by
clause so that you can append an ascending or descending property to the order by
clause.
This is exactly the same as orderBy()
.
publicorder(java.lang.String orderByClause)
order by
clause, replacing the existing order by
clause if there is one.
This is exactly the same as orderBy(String)
.
publicorderBy()
order by
clause so that you can append an ascending or descending property to the order by
clause.
This is exactly the same as order()
.
publicorderBy(java.lang.String orderByClause)
order by
clause replacing the existing order by
clause if there is one.
This is exactly the same as order(String)
.
publicselect(java.lang.String fetchProperties)
publicsetAutofetch(boolean autofetch)
publicsetBackgroundFetchAfter(int backgroundFetchAfter)
publicsetBufferFetchSizeHint(int fetchSize)
Statement.fetchSize()
.publicsetDistinct(boolean isDistinct)
DISTINCT
.publicsetFirstRow(int firstRow)
publicsetId(java.lang.Object id)
publicsetListener( queryListener)
publicsetLoadBeanCache(boolean loadBeanCache)
true
, all the beans from this query are loaded into the bean cache.publicsetMapKey(java.lang.String mapKey)
publicsetMaxRows(int maxRows)
publicsetOrder( orderBy)
order by
clause using an OrderBy
object.
This is exactly the same as #setOrderBy(com.avaje.ebean.OrderBy)
.
publicsetOrderBy( orderBy)
order by
clause.
This is exactly the same as #setOrder(com.avaje.ebean.OrderBy)
.
publicsetParameter(int position, java.lang.Object value)
publicsetParameter(java.lang.String name, java.lang.Object value)
publicsetQuery(java.lang.String oql)
publicsetRawSql(RawSql rawSql)
RawSql
to use for this query.publicsetReadOnly(boolean readOnly)
publicsetTimeout(int secs)
publicsetUseCache(boolean useBeanCache)
publicsetUseQueryCache(boolean useQueryCache)
publicsetUseIndex(UseIndex useIndex)
publicsetVanillaMode(boolean vanillaMode)
publicwhere()
where
clause with the ability to chain on the ExpressionList
.publicwhere(com.avaje.ebean.Expression expression)
Expression
to the where
clause and returns the query.publicwhere(java.lang.String addToWhereClause)
where
clause.public int getTotalHits()
publicsetForUpdate(boolean forUpdate)
public boolean isForUpdate()