public static class Model.Finder<I,T>
extends java.lang.Object
implements com.avaje.ebean.Query<T>
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.
|
com.avaje.ebean.Query<T> |
copy()
Copies this query.
|
com.avaje.ebean.Query<T> |
fetch(java.lang.String path)
Specifies a path to load including all its properties.
|
com.avaje.ebean.Query<T> |
fetch(java.lang.String path,
com.avaje.ebean.FetchConfig joinConfig)
Additionally specifies a
JoinConfig to specify a 'query join' and/or define the lazy loading query. |
com.avaje.ebean.Query<T> |
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.
|
com.avaje.ebean.Query<T> |
fetch(java.lang.String assocProperty,
java.lang.String fetchProperties,
com.avaje.ebean.FetchConfig fetchConfig)
Additionally specifies a
FetchConfig to use a separate query or lazy loading to load this path. |
com.avaje.ebean.Filter<T> |
filter()
Creates a filter for sorting and filtering lists of entities locally without going back to the database.
|
com.avaje.ebean.ExpressionList<T> |
filterMany(java.lang.String propertyName)
Applies a filter on the 'many' property list rather than the root level objects.
|
com.avaje.ebean.FutureIds<T> |
findFutureIds()
Executes a find IDs query in a background thread.
|
com.avaje.ebean.FutureList<T> |
findFutureList()
Executes a find list query in a background thread.
|
com.avaje.ebean.FutureRowCount<T> |
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.
|
com.avaje.ebean.QueryIterator<T> |
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.
|
com.avaje.ebean.PagingList<T> |
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(com.avaje.ebean.QueryResultVisitor<T> visitor) |
com.avaje.ebean.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.
|
com.avaje.ebean.RawSql |
getRawSql()
Returns the
RawSql that was set to use for this query. |
com.avaje.ebean.Query.Type |
getType()
Returns the type of query (List, Set, Map, Bean, rowCount etc).
|
com.avaje.ebean.Query.UseIndex |
getUseIndex() |
com.avaje.ebean.ExpressionList<T> |
having()
Returns the query's
having clause. |
com.avaje.ebean.Query<T> |
having(com.avaje.ebean.Expression addExpressionToHaving)
Adds an expression to the
having clause and returns the query. |
com.avaje.ebean.Query<T> |
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 . |
com.avaje.ebean.Query<T> |
join(java.lang.String path)
Same as
fetch(String) |
com.avaje.ebean.Query<T> |
join(java.lang.String path,
com.avaje.ebean.JoinConfig joinConfig)
Same as
fetch(String, FetchConfig) |
com.avaje.ebean.Query<T> |
join(java.lang.String assocProperty,
java.lang.String fetchProperties)
Same as
fetch(String, String) . |
com.avaje.ebean.Query<T> |
join(java.lang.String assocProperty,
java.lang.String fetchProperties,
com.avaje.ebean.JoinConfig joinConfig)
Additionally specifies a
JoinConfig to specify a 'query join' and or define the lazy loading query. |
I |
nextId()
Returns the next identity value.
|
Model.Finder<I,T> |
on(java.lang.String server)
Changes the Ebean server.
|
com.avaje.ebean.OrderBy<T> |
order()
Returns the
order by clause so that you can append an ascending or descending property to the order by clause. |
com.avaje.ebean.Query<T> |
order(java.lang.String orderByClause)
Sets the
order by clause, replacing the existing order by clause if there is one. |
com.avaje.ebean.OrderBy<T> |
orderBy()
Returns the
order by clause so that you can append an ascending or descending property to the order by clause. |
com.avaje.ebean.Query<T> |
orderBy(java.lang.String orderByClause)
Set the
order by clause replacing the existing order by clause if there is one. |
com.avaje.ebean.Query<T> |
query()
Creates a query.
|
T |
ref(I id)
Retrieves an entity reference for this ID.
|
com.avaje.ebean.Query<T> |
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.
|
com.avaje.ebean.Query<T> |
setAutofetch(boolean autofetch)
Explicitly specifies whether to use 'Autofetch' for this query.
|
com.avaje.ebean.Query<T> |
setBackgroundFetchAfter(int backgroundFetchAfter)
Sets the rows after which fetching should continue in a background thread.
|
com.avaje.ebean.Query<T> |
setBufferFetchSizeHint(int fetchSize)
Sets a hint, which for JDBC translates to
Statement.fetchSize() . |
com.avaje.ebean.Query<T> |
setDistinct(boolean isDistinct)
Sets whether this query uses
DISTINCT . |
com.avaje.ebean.Query<T> |
setFirstRow(int firstRow)
Sets the first row to return for this query.
|
com.avaje.ebean.Query<T> |
setId(java.lang.Object id)
Sets the ID value to query.
|
com.avaje.ebean.Query<T> |
setListener(com.avaje.ebean.QueryListener<T> queryListener)
Sets a listener to process the query on a row-by-row basis.
|
com.avaje.ebean.Query<T> |
setLoadBeanCache(boolean loadBeanCache)
When set to
true , all the beans from this query are loaded into the bean cache. |
com.avaje.ebean.Query<T> |
setMapKey(java.lang.String mapKey)
Sets the property to use as keys for a map.
|
com.avaje.ebean.Query<T> |
setMaxRows(int maxRows)
Sets the maximum number of rows to return in the query.
|
com.avaje.ebean.Query<T> |
setOrder(com.avaje.ebean.OrderBy<T> orderBy)
Replaces any existing
order by clause using an OrderBy object. |
com.avaje.ebean.Query<T> |
setOrderBy(com.avaje.ebean.OrderBy<T> orderBy)
Set an OrderBy object to replace any existing
order by clause. |
com.avaje.ebean.Query<T> |
setParameter(int position,
java.lang.Object value)
Sets an ordered bind parameter according to its position.
|
com.avaje.ebean.Query<T> |
setParameter(java.lang.String name,
java.lang.Object value)
Sets a named bind parameter.
|
com.avaje.ebean.Query<T> |
setQuery(java.lang.String oql)
Deprecated.
|
com.avaje.ebean.Query<T> |
setRawSql(com.avaje.ebean.RawSql rawSql)
Sets
RawSql to use for this query. |
com.avaje.ebean.Query<T> |
setReadOnly(boolean readOnly)
Sets whether the returned beans will be read-only.
|
com.avaje.ebean.Query<T> |
setTimeout(int secs)
Sets a timeout on this query.
|
com.avaje.ebean.Query<T> |
setUseCache(boolean useBeanCache)
Sets whether to use the bean cache.
|
com.avaje.ebean.Query<T> |
setUseIndex(com.avaje.ebean.Query.UseIndex useIndex) |
com.avaje.ebean.Query<T> |
setUseQueryCache(boolean useQueryCache)
Sets whether to use the query cache.
|
com.avaje.ebean.Query<T> |
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.
|
com.avaje.ebean.ExpressionList<T> |
where()
Adds expressions to the
where clause with the ability to chain on the ExpressionList . |
com.avaje.ebean.Query<T> |
where(com.avaje.ebean.Expression expression)
Adds a single
Expression to the where clause and returns the query. |
com.avaje.ebean.Query<T> |
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()
public com.avaje.ebean.Filter<T> filter()
public com.avaje.ebean.Query<T> query()
public I nextId()
public void cancel()
cancel
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> copy()
copy
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> fetch(java.lang.String path)
fetch
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> fetch(java.lang.String path, com.avaje.ebean.FetchConfig joinConfig)
JoinConfig
to specify a 'query join' and/or define the lazy loading query.fetch
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> fetch(java.lang.String path, java.lang.String fetchProperties)
fetch
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> fetch(java.lang.String assocProperty, java.lang.String fetchProperties, com.avaje.ebean.FetchConfig fetchConfig)
FetchConfig
to use a separate query or lazy loading to load this path.fetch
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.ExpressionList<T> filterMany(java.lang.String propertyName)
filterMany
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.FutureIds<T> findFutureIds()
findFutureIds
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.FutureList<T> findFutureList()
findFutureList
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.FutureRowCount<T> findFutureRowCount()
findFutureRowCount
in interface com.avaje.ebean.Query<T>
public java.util.List<java.lang.Object> findIds()
findIds
in interface com.avaje.ebean.Query<T>
public java.util.List<T> findList()
findList
in interface com.avaje.ebean.Query<T>
public java.util.Map<?,T> findMap()
findMap
in interface com.avaje.ebean.Query<T>
public <K> java.util.Map<K,T> findMap(java.lang.String a, java.lang.Class<K> b)
findMap
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.PagingList<T> findPagingList(int pageSize)
PagingList
for this query.findPagingList
in interface com.avaje.ebean.Query<T>
public int findRowCount()
findRowCount
in interface com.avaje.ebean.Query<T>
public java.util.Set<T> findSet()
findSet
in interface com.avaje.ebean.Query<T>
public T findUnique()
null
, if no matching bean is found.findUnique
in interface com.avaje.ebean.Query<T>
public void findVisit(com.avaje.ebean.QueryResultVisitor<T> visitor)
findVisit
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.QueryIterator<T> findIterate()
findIterate
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.ExpressionFactory getExpressionFactory()
ExpressionFactory
used by this query.getExpressionFactory
in interface com.avaje.ebean.Query<T>
public int getFirstRow()
getFirstRow
in interface com.avaje.ebean.Query<T>
public java.lang.String getGeneratedSql()
getGeneratedSql
in interface com.avaje.ebean.Query<T>
public int getMaxRows()
getMaxRows
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.RawSql getRawSql()
RawSql
that was set to use for this query.getRawSql
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query.Type getType()
getType
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query.UseIndex getUseIndex()
getUseIndex
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.ExpressionList<T> having()
having
clause.having
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> having(com.avaje.ebean.Expression addExpressionToHaving)
having
clause and returns the query.having
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> having(java.lang.String addToHavingClause)
having
clause and returns the query.having
in interface com.avaje.ebean.Query<T>
public boolean isAutofetchTuned()
true
if this query was tuned by autoFetch
.isAutofetchTuned
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> join(java.lang.String path)
fetch(String)
join
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> join(java.lang.String path, com.avaje.ebean.JoinConfig joinConfig)
fetch(String, FetchConfig)
join
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> join(java.lang.String assocProperty, java.lang.String fetchProperties)
fetch(String, String)
.join
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> join(java.lang.String assocProperty, java.lang.String fetchProperties, com.avaje.ebean.JoinConfig joinConfig)
JoinConfig
to specify a 'query join' and or define the lazy loading query.join
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.OrderBy<T> order()
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()
.
order
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> order(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)
.
order
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.OrderBy<T> orderBy()
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()
.
orderBy
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> orderBy(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)
.
orderBy
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> select(java.lang.String fetchProperties)
select
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> setAutofetch(boolean autofetch)
setAutofetch
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> setBackgroundFetchAfter(int backgroundFetchAfter)
setBackgroundFetchAfter
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> setBufferFetchSizeHint(int fetchSize)
Statement.fetchSize()
.setBufferFetchSizeHint
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> setDistinct(boolean isDistinct)
DISTINCT
.setDistinct
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> setFirstRow(int firstRow)
setFirstRow
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> setId(java.lang.Object id)
setId
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> setListener(com.avaje.ebean.QueryListener<T> queryListener)
setListener
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> setLoadBeanCache(boolean loadBeanCache)
true
, all the beans from this query are loaded into the bean cache.setLoadBeanCache
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> setMapKey(java.lang.String mapKey)
setMapKey
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> setMaxRows(int maxRows)
setMaxRows
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> setOrder(com.avaje.ebean.OrderBy<T> orderBy)
order by
clause using an OrderBy
object.
This is exactly the same as setOrderBy(com.avaje.ebean.OrderBy)
.
setOrder
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> setOrderBy(com.avaje.ebean.OrderBy<T> orderBy)
order by
clause.
This is exactly the same as setOrder(com.avaje.ebean.OrderBy)
.
setOrderBy
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> setParameter(int position, java.lang.Object value)
setParameter
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> setParameter(java.lang.String name, java.lang.Object value)
setParameter
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> setQuery(java.lang.String oql)
setQuery
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> setRawSql(com.avaje.ebean.RawSql rawSql)
RawSql
to use for this query.setRawSql
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> setReadOnly(boolean readOnly)
setReadOnly
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> setTimeout(int secs)
setTimeout
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> setUseCache(boolean useBeanCache)
setUseCache
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> setUseQueryCache(boolean useQueryCache)
setUseQueryCache
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> setUseIndex(com.avaje.ebean.Query.UseIndex useIndex)
setUseIndex
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> setVanillaMode(boolean vanillaMode)
setVanillaMode
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.ExpressionList<T> where()
where
clause with the ability to chain on the ExpressionList
.where
in interface com.avaje.ebean.Query<T>
public com.avaje.ebean.Query<T> where(com.avaje.ebean.Expression expression)
Expression
to the where
clause and returns the query.where
in interface com.avaje.ebean.Query<T>