|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.scooterframework.orm.activerecord.QueryBuilder
public class QueryBuilder
QueryBuilder class provides flexible methods for building a query.
| Method Summary | |
|---|---|
Paginator |
getPaginator()
Returns a Paginator that satisfy the query built by the QueryBuilder. |
ActiveRecord |
getRecord()
Returns the record that satisfies the query built by the QueryBuilder. |
java.util.List<ActiveRecord> |
getRecords()
Returns all the records that satisfy the query built by the QueryBuilder. |
QueryBuilder |
groupBy(java.lang.String groupBy)
Setup group-by clause. |
QueryBuilder |
having(java.lang.String having)
Setup having clause. |
QueryBuilder |
includes(java.lang.String includes)
Setup associated models for eager loading. |
QueryBuilder |
includes(java.lang.String includes,
boolean strict)
Setup associated models for eager loading. |
QueryBuilder |
includes(java.lang.String includes,
java.lang.String joinType)
Setup associated models for eager loading. |
QueryBuilder |
limit(int limit)
Setup limit for number of records per retrieval. |
QueryBuilder |
offset(int offset)
Setup number of records to skip. |
QueryBuilder |
orderBy(java.lang.String orderBy)
Setup group-by clause. |
QueryBuilder |
page(int page)
Setup current page number. |
QueryBuilder |
where(java.lang.String conditionsSQL)
Setup where clause. |
QueryBuilder |
where(java.lang.String conditionsSQL,
java.util.Map<java.lang.String,java.lang.Object> conditionsSQLDataMap)
Setup where clause. |
QueryBuilder |
where(java.lang.String conditionsSQL,
java.lang.Object[] conditionsSQLData)
Setup where clause. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public java.util.List<ActiveRecord> getRecords()
Returns all the records that satisfy the query built by the QueryBuilder.
public ActiveRecord getRecord()
Returns the record that satisfies the query built by the QueryBuilder.
public Paginator getPaginator()
Returns a Paginator that satisfy the query built by the QueryBuilder. Total number of records and paged list of records can be obtained from the returned Paginator instance.
public QueryBuilder where(java.lang.String conditionsSQL)
Setup where clause.
conditionsSQL - a valid SQL query where clause string
public QueryBuilder where(java.lang.String conditionsSQL,
java.lang.Object[] conditionsSQLData)
Setup where clause.
conditionsSQL - a valid SQL query where clause stringconditionsSQLData - an array of data for the conditionsSQL string
public QueryBuilder where(java.lang.String conditionsSQL,
java.util.Map<java.lang.String,java.lang.Object> conditionsSQLDataMap)
Setup where clause.
conditionsSQL - a valid SQL query where clause stringconditionsSQLDataMap - a map of data for the keys in the conditionsSQL string
public QueryBuilder includes(java.lang.String includes)
Setup associated models for eager loading.
includes - a string of associated models
public QueryBuilder includes(java.lang.String includes,
java.lang.String joinType)
Setup associated models for eager loading.
includes - a string of associated modelsjoinType - type of join
public QueryBuilder includes(java.lang.String includes,
boolean strict)
Setup associated models for eager loading.
If strict is true, then child records can only be accessed through their parent.
includes - a string of associated modelsstrict - true if strict
public QueryBuilder groupBy(java.lang.String groupBy)
Setup group-by clause.
groupBy - a valid SQL query group-by clause string
public QueryBuilder having(java.lang.String having)
Setup having clause.
having - a valid SQL query having clause string
public QueryBuilder orderBy(java.lang.String orderBy)
Setup group-by clause.
orderBy - a valid SQL query order-by clause string
public QueryBuilder limit(int limit)
Setup limit for number of records per retrieval.
limit - number of records for each retrieval
public QueryBuilder offset(int offset)
Setup number of records to skip.
offset - number of records to skip
public QueryBuilder page(int page)
Setup current page number. All records in previous pages are skipped.
The first page is 1, not 0.
page - current page number
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||