public class DefaultRelationalQuery extends Object implements SpiSqlQuery
| Constructor and Description |
|---|
DefaultRelationalQuery(EbeanServer server,
String query)
Additional supply a query detail object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
Cancel the query if support by the underlying database and driver.
|
SqlFutureList |
findFutureList()
Execute find list SQL query in a background thread.
|
List<SqlRow> |
findList()
Execute the query returning a list.
|
Map<?,SqlRow> |
findMap()
Execute the query returning a map.
|
Set<SqlRow> |
findSet()
Execute the query returning a set.
|
SqlRow |
findUnique()
Execute the query returning a single row or null.
|
int |
getBackgroundFetchAfter()
Return the number of rows after which background fetching occurs.
|
BindParams |
getBindParams()
Return the named or positioned parameters.
|
int |
getBufferFetchSizeHint()
Return the hint for Statement.setFetchSize().
|
int |
getFirstRow()
Return the first row to fetch.
|
SqlQueryListener |
getListener()
Return the findListener is one has been set.
|
String |
getMapKey()
Return the key property for maps.
|
int |
getMaxRows()
Return the maximum number of rows to fetch.
|
String |
getQuery()
return the query.
|
int |
getTimeout()
Return the query timeout.
|
boolean |
isCancelled()
Return true if the query has been cancelled.
|
boolean |
isFutureFetch()
Return true if this is a future fetch type query.
|
DefaultRelationalQuery |
setBackgroundFetchAfter(int backgroundFetchAfter)
Set the index after which fetching continues in a background thread.
|
DefaultRelationalQuery |
setBufferFetchSizeHint(int bufferFetchSizeHint)
A hint which for JDBC translates to the Statement.fetchSize().
|
DefaultRelationalQuery |
setFirstRow(int firstRow)
Set the index of the first row of the results to return.
|
void |
setFutureFetch(boolean futureFetch)
Set to true if this is a future fetch type query.
|
DefaultRelationalQuery |
setListener(SqlQueryListener queryListener)
Set a listener.
|
DefaultRelationalQuery |
setMapKey(String mapKey)
Set the column to use to determine the keys for a Map.
|
DefaultRelationalQuery |
setMaxRows(int maxRows)
Set the maximum number of query results to return.
|
DefaultRelationalQuery |
setParameter(int position,
Object value)
The same as bind for positioned parameters.
|
DefaultRelationalQuery |
setParameter(String paramName,
Object value)
The same as bind for named parameters.
|
void |
setPreparedStatement(PreparedStatement pstmt)
Set the PreparedStatement for the purposes of supporting cancel.
|
DefaultRelationalQuery |
setQuery(String query) |
DefaultRelationalQuery |
setTimeout(int secs)
Set a timeout on this query.
|
String |
toString() |
public DefaultRelationalQuery(EbeanServer server, String query)
public DefaultRelationalQuery setQuery(String query)
public List<SqlRow> findList()
SqlQuerypublic Set<SqlRow> findSet()
SqlQuerypublic Map<?,SqlRow> findMap()
SqlQuerypublic SqlRow findUnique()
SqlQueryIf this query finds 2 or more rows then it will throw a PersistenceException.
findUnique in interface SqlQuerypublic SqlFutureList findFutureList()
SqlQueryThis returns a Future object which can be used to cancel, check the execution status (isDone etc) and get the value (with or without a timeout).
findFutureList in interface SqlQuerypublic DefaultRelationalQuery setParameter(int position, Object value)
SqlQuerysetParameter in interface SqlQuerypublic DefaultRelationalQuery setParameter(String paramName, Object value)
SqlQuerysetParameter in interface SqlQuerypublic SqlQueryListener getListener()
getListener in interface SpiSqlQuerypublic DefaultRelationalQuery setListener(SqlQueryListener queryListener)
Note that the returning List Set or Map will be empty.
setListener in interface SqlQuerypublic int getFirstRow()
SpiSqlQuerygetFirstRow in interface SpiSqlQuerypublic DefaultRelationalQuery setFirstRow(int firstRow)
SqlQuerysetFirstRow in interface SqlQuerypublic int getMaxRows()
SpiSqlQuerygetMaxRows in interface SpiSqlQuerypublic DefaultRelationalQuery setMaxRows(int maxRows)
SqlQuerysetMaxRows in interface SqlQuerypublic String getMapKey()
SpiSqlQuerygetMapKey in interface SpiSqlQuerypublic DefaultRelationalQuery setMapKey(String mapKey)
SqlQuerypublic int getBackgroundFetchAfter()
SpiSqlQuerygetBackgroundFetchAfter in interface SpiSqlQuerypublic DefaultRelationalQuery setBackgroundFetchAfter(int backgroundFetchAfter)
SqlQuerysetBackgroundFetchAfter in interface SqlQuerypublic int getTimeout()
SpiSqlQuerygetTimeout in interface SpiSqlQuerypublic DefaultRelationalQuery setTimeout(int secs)
SqlQueryThis will typically result in a call to setQueryTimeout() on a preparedStatement. If the timeout occurs an exception will be thrown - this will be a SQLException wrapped up in a PersistenceException.
setTimeout in interface SqlQuerysecs - the query timeout limit in seconds. Zero means there is no limit.public BindParams getBindParams()
SpiSqlQuerygetBindParams in interface SpiSqlQuerypublic DefaultRelationalQuery setBufferFetchSizeHint(int bufferFetchSizeHint)
SqlQueryGives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed for ResultSet.
setBufferFetchSizeHint in interface SqlQuerypublic int getBufferFetchSizeHint()
SpiSqlQuerygetBufferFetchSizeHint in interface SpiSqlQuerypublic String getQuery()
SpiSqlQuerygetQuery in interface SpiSqlQuerypublic boolean isFutureFetch()
SpiSqlQueryisFutureFetch in interface SpiSqlQuerypublic void setFutureFetch(boolean futureFetch)
SpiSqlQuerysetFutureFetch in interface SpiSqlQuerypublic void setPreparedStatement(PreparedStatement pstmt)
SpiSqlQuerysetPreparedStatement in interface SpiSqlQuerypublic void cancel()
SqlQueryThis must be called from a different thread to the one executing the query.
public boolean isCancelled()
SpiSqlQueryisCancelled in interface SpiSqlQueryCopyright © 2014. All Rights Reserved.