dk.eobjects.metamodel.query
Class Query
java.lang.Object
dk.eobjects.metamodel.query.Query
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable
public class Query
- extends java.lang.Object
- implements java.lang.Cloneable, java.io.Serializable
Represents a query to retrieve data by. A query is made up of six clauses,
equivalent to the SQL standard:
- the SELECT clause, which define the wanted columns of the resulting
DataSet
- the FROM clause, which define where to retrieve the data from
- the WHERE clause, which define filters on the retrieved data
- the GROUP BY clause, which define if the result should be grouped and
aggregated according to some columns acting as categories
- the HAVING clause, which define filters on the grouped data
- the ORDER BY clause, which define sorting of the resulting dataset
Queries are executed using the DataContext.executeQuery method or can
alternatively be used directly in JDBC by using the toString() method.
- See Also:
DataContext,
Serialized Form
|
Constructor Summary |
Query()
|
|
Method Summary |
Query |
clone()
|
boolean |
equals(java.lang.Object obj)
|
Query |
from(FromItem... items)
|
Query |
from(java.lang.String expression)
|
Query |
from(Table table)
|
Query |
from(Table table,
java.lang.String alias)
|
Query |
from(Table leftTable,
Table rightTable,
JoinType joinType,
Column leftOnColumn,
Column rightOnColumn)
|
FromClause |
getFromClause()
|
GroupByClause |
getGroupByClause()
|
FilterClause |
getHavingClause()
|
java.lang.Integer |
getMaxRows()
|
OrderByClause |
getOrderByClause()
|
SelectClause |
getSelectClause()
|
FilterClause |
getWhereClause()
|
Query |
groupBy(Column... columns)
|
Query |
groupBy(GroupByItem... items)
|
Query |
having(Column column,
OperatorType operatorType,
java.lang.Object operand)
|
Query |
having(FilterItem... items)
|
Query |
having(java.lang.String expression)
|
Query |
orderBy(Column column)
|
Query |
orderBy(Column column,
boolean ascending)
Deprecated. use orderBy(Column, Direction) instead |
Query |
orderBy(Column column,
OrderByItem.Direction direction)
|
Query |
orderBy(OrderByItem... items)
|
Query |
select(Column... columns)
|
Query |
select(FunctionType functionType,
Column column)
|
Query |
select(SelectItem... items)
|
Query |
select(java.lang.String expression)
|
Query |
select(java.lang.String expression,
java.lang.String alias)
|
Query |
selectCount()
|
Query |
selectDistinct()
|
Query |
setMaxRows(java.lang.Integer maxRows)
Sets the maximum number of rows to be queried. |
java.lang.String |
toString()
|
Query |
where(Column column,
OperatorType operatorType,
java.lang.Object operand)
|
Query |
where(FilterItem... items)
|
Query |
where(java.lang.String expression)
|
| Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Query
public Query()
select
public Query select(Column... columns)
select
public Query select(SelectItem... items)
select
public Query select(FunctionType functionType,
Column column)
select
public Query select(java.lang.String expression,
java.lang.String alias)
select
public Query select(java.lang.String expression)
selectDistinct
public Query selectDistinct()
selectCount
public Query selectCount()
from
public Query from(FromItem... items)
from
public Query from(Table table)
from
public Query from(java.lang.String expression)
from
public Query from(Table table,
java.lang.String alias)
from
public Query from(Table leftTable,
Table rightTable,
JoinType joinType,
Column leftOnColumn,
Column rightOnColumn)
groupBy
public Query groupBy(GroupByItem... items)
groupBy
public Query groupBy(Column... columns)
orderBy
public Query orderBy(OrderByItem... items)
orderBy
public Query orderBy(Column column)
orderBy
@Deprecated
public Query orderBy(Column column,
boolean ascending)
- Deprecated. use orderBy(Column, Direction) instead
orderBy
public Query orderBy(Column column,
OrderByItem.Direction direction)
where
public Query where(FilterItem... items)
where
public Query where(java.lang.String expression)
where
public Query where(Column column,
OperatorType operatorType,
java.lang.Object operand)
having
public Query having(FilterItem... items)
having
public Query having(Column column,
OperatorType operatorType,
java.lang.Object operand)
having
public Query having(java.lang.String expression)
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object
getSelectClause
public SelectClause getSelectClause()
getFromClause
public FromClause getFromClause()
getWhereClause
public FilterClause getWhereClause()
getGroupByClause
public GroupByClause getGroupByClause()
getHavingClause
public FilterClause getHavingClause()
getOrderByClause
public OrderByClause getOrderByClause()
setMaxRows
public Query setMaxRows(java.lang.Integer maxRows)
- Sets the maximum number of rows to be queried. If the result of the query
yields more rows they should be discarded.
- Parameters:
maxRows - the number of desired maximum rows. Can be null (default) for
no limits
getMaxRows
public java.lang.Integer getMaxRows()
- Returns:
- the number of maximum rows to yield from executing this query or
null if no maximum/limit is set.
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals in class java.lang.Object
clone
public Query clone()
- Overrides:
clone in class java.lang.Object
Copyright © 2007-2010. All Rights Reserved.