models.ebean
Class RawSQLFinder<T>

java.lang.Object
  extended by models.ebean.RawSQLFinder<T>
All Implemented Interfaces:
com.avaje.ebean.Query<T>, java.io.Serializable

public class RawSQLFinder<T>
extends java.lang.Object
implements com.avaje.ebean.Query<T>

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.avaje.ebean.Query
com.avaje.ebean.Query.UseIndex
 
Constructor Summary
RawSQLFinder(java.lang.Class<T> type, java.lang.String sql, java.util.Map<java.lang.String,java.lang.String> bindings)
           
RawSQLFinder(java.lang.String serverName, java.lang.Class<T> type, java.lang.String sql, java.util.Map<java.lang.String,java.lang.String> bindings)
          Creates a finder for entity of type T with ID of type I, using a specific Ebean server.
 
Method Summary
 java.util.List<T> all()
          Retrieves all entities of the given type.
 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.
 int getTotalHits()
           
 com.avaje.ebean.Query.UseIndex getUseIndex()
          Returns the type of query (List, Set, Map, Bean, rowCount etc).
 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.
 boolean isForUpdate()
           
 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.FetchConfig joinConfig)
          Same as fetch(String, com.avaje.ebean.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.FetchConfig joinConfig)
          Additionally specifies a JoinConfig to specify a 'query join' and or define the lazy loading query.
 RawSQLFinder<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.
 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> setForUpdate(boolean forUpdate)
           
 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> 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RawSQLFinder

public RawSQLFinder(java.lang.Class<T> type,
                    java.lang.String sql,
                    java.util.Map<java.lang.String,java.lang.String> bindings)

RawSQLFinder

public RawSQLFinder(java.lang.String serverName,
                    java.lang.Class<T> type,
                    java.lang.String sql,
                    java.util.Map<java.lang.String,java.lang.String> bindings)
Creates a finder for entity of type T with ID of type I, using a specific Ebean server.

Method Detail

on

public RawSQLFinder<T> on(java.lang.String server)
Changes the Ebean server.


all

public java.util.List<T> all()
Retrieves all entities of the given type.


filter

public com.avaje.ebean.Filter<T> filter()
Creates a filter for sorting and filtering lists of entities locally without going back to the database.


query

public com.avaje.ebean.Query<T> query()
Creates a query.


cancel

public void cancel()
Cancels query execution, if supported by the underlying database and driver.

Specified by:
cancel in interface com.avaje.ebean.Query<T>

copy

public com.avaje.ebean.Query<T> copy()
Copies this query.

Specified by:
copy in interface com.avaje.ebean.Query<T>

fetch

public com.avaje.ebean.Query<T> fetch(java.lang.String path)
Specifies a path to load including all its properties.

Specified by:
fetch in interface com.avaje.ebean.Query<T>

fetch

public 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.

Specified by:
fetch in interface com.avaje.ebean.Query<T>

fetch

public 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.

Specified by:
fetch in interface com.avaje.ebean.Query<T>

fetch

public 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.

Specified by:
fetch in interface com.avaje.ebean.Query<T>

filterMany

public com.avaje.ebean.ExpressionList<T> filterMany(java.lang.String propertyName)
Applies a filter on the 'many' property list rather than the root level objects.

Specified by:
filterMany in interface com.avaje.ebean.Query<T>

findFutureIds

public com.avaje.ebean.FutureIds<T> findFutureIds()
Executes a find IDs query in a background thread.

Specified by:
findFutureIds in interface com.avaje.ebean.Query<T>

findFutureList

public com.avaje.ebean.FutureList<T> findFutureList()
Executes a find list query in a background thread.

Specified by:
findFutureList in interface com.avaje.ebean.Query<T>

findFutureRowCount

public com.avaje.ebean.FutureRowCount<T> findFutureRowCount()
Executes a find row count query in a background thread.

Specified by:
findFutureRowCount in interface com.avaje.ebean.Query<T>

findIds

public java.util.List<java.lang.Object> findIds()
Executes a query and returns the results as a list of IDs.

Specified by:
findIds in interface com.avaje.ebean.Query<T>

findList

public java.util.List<T> findList()
Executes the query and returns the results as a list of objects.

Specified by:
findList in interface com.avaje.ebean.Query<T>

findMap

public java.util.Map<?,T> findMap()
Executes the query and returns the results as a map of objects.

Specified by:
findMap in interface com.avaje.ebean.Query<T>

findMap

public <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.

Specified by:
findMap in interface com.avaje.ebean.Query<T>

findPagingList

public com.avaje.ebean.PagingList<T> findPagingList(int pageSize)
Returns a PagingList for this query.

Specified by:
findPagingList in interface com.avaje.ebean.Query<T>

findRowCount

public int findRowCount()
Returns the number of entities this query should return.

Specified by:
findRowCount in interface com.avaje.ebean.Query<T>

findSet

public java.util.Set<T> findSet()
Executes the query and returns the results as a set of objects.

Specified by:
findSet in interface com.avaje.ebean.Query<T>

findUnique

public T findUnique()
Executes the query and returns the results as either a single bean or null, if no matching bean is found.

Specified by:
findUnique in interface com.avaje.ebean.Query<T>

findVisit

public void findVisit(com.avaje.ebean.QueryResultVisitor<T> visitor)
Specified by:
findVisit in interface com.avaje.ebean.Query<T>

findIterate

public com.avaje.ebean.QueryIterator<T> findIterate()
Specified by:
findIterate in interface com.avaje.ebean.Query<T>

getExpressionFactory

public com.avaje.ebean.ExpressionFactory getExpressionFactory()
Returns the ExpressionFactory used by this query.

Specified by:
getExpressionFactory in interface com.avaje.ebean.Query<T>

getFirstRow

public int getFirstRow()
Returns the first row value.

Specified by:
getFirstRow in interface com.avaje.ebean.Query<T>

getGeneratedSql

public java.lang.String getGeneratedSql()
Returns the SQL that was generated for executing this query.

Specified by:
getGeneratedSql in interface com.avaje.ebean.Query<T>

getMaxRows

public int getMaxRows()
Returns the maximum of rows for this query.

Specified by:
getMaxRows in interface com.avaje.ebean.Query<T>

getRawSql

public com.avaje.ebean.RawSql getRawSql()
Returns the RawSql that was set to use for this query.

Specified by:
getRawSql in interface com.avaje.ebean.Query<T>

getUseIndex

public com.avaje.ebean.Query.UseIndex getUseIndex()
Returns the type of query (List, Set, Map, Bean, rowCount etc). public Type getType() { return query().getType(); }

Specified by:
getUseIndex in interface com.avaje.ebean.Query<T>

having

public com.avaje.ebean.ExpressionList<T> having()
Returns the query's having clause.

Specified by:
having in interface com.avaje.ebean.Query<T>

having

public com.avaje.ebean.Query<T> having(com.avaje.ebean.Expression addExpressionToHaving)
Adds an expression to the having clause and returns the query.

Specified by:
having in interface com.avaje.ebean.Query<T>

having

public com.avaje.ebean.Query<T> having(java.lang.String addToHavingClause)
Adds clauses to the having clause and returns the query.

Specified by:
having in interface com.avaje.ebean.Query<T>

isAutofetchTuned

public boolean isAutofetchTuned()
Returns true if this query was tuned by autoFetch.

Specified by:
isAutofetchTuned in interface com.avaje.ebean.Query<T>

join

public com.avaje.ebean.Query<T> join(java.lang.String path)
Same as fetch(String)


join

public com.avaje.ebean.Query<T> join(java.lang.String path,
                                     com.avaje.ebean.FetchConfig joinConfig)
Same as fetch(String, com.avaje.ebean.FetchConfig)


join

public com.avaje.ebean.Query<T> join(java.lang.String assocProperty,
                                     java.lang.String fetchProperties)
Same as fetch(String, String).


join

public com.avaje.ebean.Query<T> join(java.lang.String assocProperty,
                                     java.lang.String fetchProperties,
                                     com.avaje.ebean.FetchConfig joinConfig)
Additionally specifies a JoinConfig to specify a 'query join' and or define the lazy loading query.


order

public 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.

This is exactly the same as orderBy().

Specified by:
order in interface com.avaje.ebean.Query<T>

order

public 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.

This is exactly the same as orderBy(String).

Specified by:
order in interface com.avaje.ebean.Query<T>

orderBy

public 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.

This is exactly the same as order().

Specified by:
orderBy in interface com.avaje.ebean.Query<T>

orderBy

public 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.

This is exactly the same as order(String).

Specified by:
orderBy in interface com.avaje.ebean.Query<T>

select

public 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.

Specified by:
select in interface com.avaje.ebean.Query<T>

setAutofetch

public com.avaje.ebean.Query<T> setAutofetch(boolean autofetch)
Explicitly specifies whether to use 'Autofetch' for this query.

Specified by:
setAutofetch in interface com.avaje.ebean.Query<T>

setBackgroundFetchAfter

public com.avaje.ebean.Query<T> setBackgroundFetchAfter(int backgroundFetchAfter)
Sets the rows after which fetching should continue in a background thread.

Specified by:
setBackgroundFetchAfter in interface com.avaje.ebean.Query<T>

setBufferFetchSizeHint

public com.avaje.ebean.Query<T> setBufferFetchSizeHint(int fetchSize)
Sets a hint, which for JDBC translates to Statement.fetchSize().

Specified by:
setBufferFetchSizeHint in interface com.avaje.ebean.Query<T>

setDistinct

public com.avaje.ebean.Query<T> setDistinct(boolean isDistinct)
Sets whether this query uses DISTINCT.

Specified by:
setDistinct in interface com.avaje.ebean.Query<T>

setFirstRow

public com.avaje.ebean.Query<T> setFirstRow(int firstRow)
Sets the first row to return for this query.

Specified by:
setFirstRow in interface com.avaje.ebean.Query<T>

setId

public com.avaje.ebean.Query<T> setId(java.lang.Object id)
Sets the ID value to query.

Specified by:
setId in interface com.avaje.ebean.Query<T>

setListener

public 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.

Specified by:
setListener in interface com.avaje.ebean.Query<T>

setLoadBeanCache

public com.avaje.ebean.Query<T> setLoadBeanCache(boolean loadBeanCache)
When set to true, all the beans from this query are loaded into the bean cache.

Specified by:
setLoadBeanCache in interface com.avaje.ebean.Query<T>

setMapKey

public com.avaje.ebean.Query<T> setMapKey(java.lang.String mapKey)
Sets the property to use as keys for a map.

Specified by:
setMapKey in interface com.avaje.ebean.Query<T>

setMaxRows

public com.avaje.ebean.Query<T> setMaxRows(int maxRows)
Sets the maximum number of rows to return in the query.

Specified by:
setMaxRows in interface com.avaje.ebean.Query<T>

setOrder

public com.avaje.ebean.Query<T> setOrder(com.avaje.ebean.OrderBy<T> orderBy)
Replaces any existing order by clause using an OrderBy object.

This is exactly the same as setOrderBy(com.avaje.ebean.OrderBy).

Specified by:
setOrder in interface com.avaje.ebean.Query<T>

setOrderBy

public com.avaje.ebean.Query<T> setOrderBy(com.avaje.ebean.OrderBy<T> orderBy)
Set an OrderBy object to replace any existing order by clause.

This is exactly the same as setOrder(com.avaje.ebean.OrderBy).

Specified by:
setOrderBy in interface com.avaje.ebean.Query<T>

setParameter

public com.avaje.ebean.Query<T> setParameter(int position,
                                             java.lang.Object value)
Sets an ordered bind parameter according to its position.

Specified by:
setParameter in interface com.avaje.ebean.Query<T>

setParameter

public com.avaje.ebean.Query<T> setParameter(java.lang.String name,
                                             java.lang.Object value)
Sets a named bind parameter.

Specified by:
setParameter in interface com.avaje.ebean.Query<T>

setRawSql

public com.avaje.ebean.Query<T> setRawSql(com.avaje.ebean.RawSql rawSql)
Sets RawSql to use for this query.

Specified by:
setRawSql in interface com.avaje.ebean.Query<T>

setReadOnly

public com.avaje.ebean.Query<T> setReadOnly(boolean readOnly)
Sets whether the returned beans will be read-only.

Specified by:
setReadOnly in interface com.avaje.ebean.Query<T>

setTimeout

public com.avaje.ebean.Query<T> setTimeout(int secs)
Sets a timeout on this query.

Specified by:
setTimeout in interface com.avaje.ebean.Query<T>

setUseCache

public com.avaje.ebean.Query<T> setUseCache(boolean useBeanCache)
Sets whether to use the bean cache.

Specified by:
setUseCache in interface com.avaje.ebean.Query<T>

setUseQueryCache

public com.avaje.ebean.Query<T> setUseQueryCache(boolean useQueryCache)
Sets whether to use the query cache.

Specified by:
setUseQueryCache in interface com.avaje.ebean.Query<T>

setUseIndex

public com.avaje.ebean.Query<T> setUseIndex(com.avaje.ebean.Query.UseIndex useIndex)
Specified by:
setUseIndex in interface com.avaje.ebean.Query<T>

setVanillaMode

public 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.

Specified by:
setVanillaMode in interface com.avaje.ebean.Query<T>

where

public com.avaje.ebean.ExpressionList<T> where()
Adds expressions to the where clause with the ability to chain on the ExpressionList.

Specified by:
where in interface com.avaje.ebean.Query<T>

where

public com.avaje.ebean.Query<T> where(com.avaje.ebean.Expression expression)
Adds a single Expression to the where clause and returns the query.

Specified by:
where in interface com.avaje.ebean.Query<T>

where

public com.avaje.ebean.Query<T> where(java.lang.String addToWhereClause)
Adds additional clauses to the where clause.

Specified by:
where in interface com.avaje.ebean.Query<T>

getTotalHits

public int getTotalHits()
Specified by:
getTotalHits in interface com.avaje.ebean.Query<T>

setForUpdate

public com.avaje.ebean.Query<T> setForUpdate(boolean forUpdate)
Specified by:
setForUpdate in interface com.avaje.ebean.Query<T>

isForUpdate

public boolean isForUpdate()
Specified by:
isForUpdate in interface com.avaje.ebean.Query<T>