|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.java.ao.Query
public class Query
A cross-database representation of a SELECT query, independent of database provider type.
Use with DatabaseProvider.renderQuery(Query, net.java.ao.schema.TableNameConverter, boolean)
to produce the database-specific SQL.
Nested Class Summary | |
---|---|
static class |
Query.QueryType
|
Constructor Summary | |
---|---|
Query(Query.QueryType type,
String fields)
Create a Query and set the field list in the SELECT clause. |
Method Summary | ||
---|---|---|
Query |
alias(Class<? extends RawEntity<?>> table,
String alias)
|
|
Query |
distinct()
|
|
Query |
from(Class<? extends RawEntity<?>> tableType)
|
|
Query |
from(String table)
|
|
String |
getAlias(Class<? extends RawEntity<?>> table)
|
|
String[] |
getCanonicalFields(EntityInfo<?,?> entityInfo)
|
|
Iterable<String> |
getFields()
|
|
String |
getGroupClause()
|
|
Map<Class<? extends RawEntity<?>>,String> |
getJoins()
|
|
int |
getLimit()
|
|
int |
getOffset()
|
|
String |
getOrderClause()
|
|
String |
getTable()
|
|
Class<? extends RawEntity<?>> |
getTableType()
|
|
Query.QueryType |
getType()
|
|
String |
getWhereClause()
|
|
Object[] |
getWhereParams()
|
|
Query |
group(String clause)
|
|
boolean |
isDistinct()
|
|
Query |
join(Class<? extends RawEntity<?>> join)
|
|
Query |
join(Class<? extends RawEntity<?>> join,
String on)
|
|
Query |
limit(int limit)
|
|
Query |
offset(int offset)
|
|
Query |
order(String clause)
|
|
static Query |
select()
Create a Query which will select the primary key field of the entity. |
|
static Query |
select(String fields)
Create a Query and set the field list in the SELECT clause. |
|
static Query |
selectAll()
Deprecated. |
|
void |
setDistinct(boolean distinct)
|
|
void |
setGroupClause(String groupClause)
|
|
void |
setJoins(Map<Class<? extends RawEntity<?>>,String> joins)
|
|
void |
setLimit(int limit)
|
|
void |
setOffset(int offset)
|
|
void |
setOrderClause(String orderClause)
|
|
protected void |
setParameters(EntityManager manager,
PreparedStatement stmt)
|
|
void |
setTable(String table)
|
|
void |
setTableType(Class<? extends RawEntity<?>> tableType)
|
|
void |
setWhereClause(String whereClause)
|
|
void |
setWhereParams(Object[] whereParams)
|
|
protected
|
toSQL(EntityInfo<? extends RawEntity<K>,K> entityInfo,
DatabaseProvider provider,
TableNameConverter converter,
boolean count)
|
|
Query |
where(String clause,
Object... params)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Query(Query.QueryType type, String fields)
Query
and set the field list in the SELECT
clause.
fields
- The fields to select, as comma-delimited field names. Spaces are OK. Must not contain "*"
.
IllegalArgumentException
- if fields contains "*"
Method Detail |
---|
public Iterable<String> getFields()
public Query distinct()
public Query from(Class<? extends RawEntity<?>> tableType)
public Query from(String table)
public Query where(String clause, Object... params)
public Query order(String clause)
public Query group(String clause)
public Query limit(int limit)
public Query offset(int offset)
public Query alias(Class<? extends RawEntity<?>> table, String alias)
public String getAlias(Class<? extends RawEntity<?>> table)
public Query join(Class<? extends RawEntity<?>> join, String on)
public Query join(Class<? extends RawEntity<?>> join)
public boolean isDistinct()
public void setDistinct(boolean distinct)
public Class<? extends RawEntity<?>> getTableType()
public void setTableType(Class<? extends RawEntity<?>> tableType)
public String getTable()
public void setTable(String table)
public String getWhereClause()
public void setWhereClause(String whereClause)
public Object[] getWhereParams()
public void setWhereParams(Object[] whereParams)
public String getOrderClause()
public void setOrderClause(String orderClause)
public String getGroupClause()
public void setGroupClause(String groupClause)
public int getLimit()
public void setLimit(int limit)
public int getOffset()
public void setOffset(int offset)
public Map<Class<? extends RawEntity<?>>,String> getJoins()
public void setJoins(Map<Class<? extends RawEntity<?>>,String> joins)
public Query.QueryType getType()
public String[] getCanonicalFields(EntityInfo<?,?> entityInfo)
protected <K> String toSQL(EntityInfo<? extends RawEntity<K>,K> entityInfo, DatabaseProvider provider, TableNameConverter converter, boolean count)
protected void setParameters(EntityManager manager, PreparedStatement stmt) throws SQLException
SQLException
public static Query select()
Query
which will select the primary key field of the entity.
@Deprecated public static Query selectAll()
select(String)
disallows "*".
TODO: Remove this as part of AO-553 work.
Create a Query
and set the field list in the SELECT
clause to "*"
.
public static Query select(String fields)
Query
and set the field list in the SELECT
clause.
fields
- The fields to select, as comma-delimited field names. Spaces are OK. Must not contain "*"
.
IllegalArgumentException
- if fields contains "*"
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |