public class Query extends Object implements Serializable
Use with DatabaseProvider.renderQuery(Query, net.java.ao.schema.TableNameConverter, boolean)
to produce the database-specific SQL.
Modifier and Type | Class and Description |
---|---|
static class |
Query.FieldMetadata |
static class |
Query.QueryType |
Modifier and Type | Field and Description |
---|---|
protected static Pattern |
AGGREGATE_FUNCTION_PATTERN |
protected static Pattern |
ALIAS_PATTERN |
Constructor and Description |
---|
Query(Query.QueryType type,
String fields)
Create a
Query and set the field list in the SELECT clause. |
protected static final Pattern ALIAS_PATTERN
protected static final Pattern AGGREGATE_FUNCTION_PATTERN
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 "*"
public List<Query.FieldMetadata> getFieldMetadata()
public Query distinct()
public Query limit(int limit)
public Query offset(int offset)
public boolean isDistinct()
public void setDistinct(boolean distinct)
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 String getHavingClause()
public void setHavingClause(String havingClause)
public int getLimit()
public void setLimit(int limit)
public int getOffset()
public void setOffset(int offset)
public Query.QueryType getType()
public String[] getCanonicalFields(EntityInfo<?,?> entityInfo)
protected Query.FieldMetadata getSingleFieldMetadata(String field)
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.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 "*"
Copyright © 2007–2022 Atlassian. All rights reserved.