|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.cayenne.query.IndirectQuery
org.apache.cayenne.query.SQLSelect<T>
public class SQLSelect<T>
A selecting query based on raw SQL and featuring fluent API.
Field Summary | |
---|---|
protected String[] |
cacheGroups
|
protected QueryCacheStrategy |
cacheStrategy
|
protected CapsStrategy |
columnNameCaps
|
protected String |
dataMapName
|
protected int |
limit
|
protected int |
offset
|
protected int |
pageSize
|
protected Map<String,Object> |
parameters
|
protected Class<T> |
persistentType
|
protected Class<T> |
scalarType
|
protected StringBuilder |
sqlBuffer
|
protected int |
statementFetchSize
|
Fields inherited from class org.apache.cayenne.query.IndirectQuery |
---|
dataMap, lastResolver, name, replacementQuery |
Constructor Summary | |
---|---|
SQLSelect(Class<T> persistentType,
String sql)
|
|
SQLSelect(String sql)
|
Method Summary | ||
---|---|---|
SQLSelect<T> |
append(String sqlChunk)
Appends a piece of SQL to the previously stored SQL template. |
|
SQLSelect<T> |
bind(String name,
Object value)
|
|
SQLSelect<T> |
cacheGroups(String... cacheGroups)
|
|
SQLSelect<T> |
cacheStrategy(QueryCacheStrategy strategy)
|
|
SQLSelect<T> |
columnNameCaps(CapsStrategy columnNameCaps)
Sets a column name capitalization policy applied to selecting queries. |
|
protected Query |
createReplacementQuery(EntityResolver resolver)
Creates a substitute query. |
|
static SQLSelect<DataRow> |
dataRowQuery(String sql)
Creates a query that selects DataRows and uses default routing. |
|
static SQLSelect<DataRow> |
dataRowQuery(String dataMapName,
String sql)
Creates a query that selects DataRows and uses routing based on the provided DataMap name. |
|
String[] |
getCacheGroups()
|
|
QueryCacheStrategy |
getCacheStrategy()
|
|
CapsStrategy |
getColumnNameCaps()
Returns a column name capitalization policy applied to selecting queries. |
|
int |
getLimit()
|
|
int |
getOffset()
|
|
int |
getPageSize()
|
|
Map<String,Object> |
getParameters()
Returns mutable map of parameters that will be bound to SQL. |
|
String |
getSql()
|
|
int |
getStatementFetchSize()
|
|
boolean |
isFetchingDataRows()
|
|
boolean |
isFetchingScalars()
|
|
SQLSelect<T> |
limit(int fetchLimit)
|
|
SQLSelect<T> |
lowerColumnNames()
Equivalent of setting CapsStrategy.LOWER |
|
SQLSelect<T> |
offset(int fetchOffset)
|
|
SQLSelect<T> |
pageSize(int pageSize)
|
|
static
|
query(Class<T> type,
String sql)
Creates a query that selects DataObjects. |
|
static
|
scalarQuery(Class<T> type,
String sql)
Creates a query that selects scalar values and uses default routing. |
|
static
|
scalarQuery(Class<T> type,
String dataMapName,
String sql)
Creates a query that selects scalar values and uses routing based on the provided DataMap name. |
|
List<T> |
select(ObjectContext context)
Selects objects using provided context. |
|
T |
selectOne(ObjectContext context)
Selects a single object using provided context. |
|
SQLSelect<T> |
statementFetchSize(int size)
Sets JDBC statement's fetch size (0 for no default size) |
|
SQLSelect<T> |
upperColumnNames()
Equivalent of setting CapsStrategy.UPPER |
|
void |
useLocalCache(String... cacheGroups)
Instructs Cayenne to look for query results in the "local" cache when running the query. |
|
SQLSelect<T> |
useSharedCache(String... cacheGroups)
Instructs Cayenne to look for query results in the "shared" cache when running the query. |
Methods inherited from class org.apache.cayenne.query.IndirectQuery |
---|
acceptVisitor, createSQLAction, getDataMap, getMetaData, getName, getReplacementQuery, route, setDataMap, setName |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.cayenne.query.Query |
---|
createSQLAction, getDataMap, getMetaData, getName, route |
Methods inherited from interface org.apache.cayenne.configuration.ConfigurationNode |
---|
acceptVisitor |
Field Detail |
---|
protected Class<T> persistentType
protected Class<T> scalarType
protected String dataMapName
protected StringBuilder sqlBuffer
protected QueryCacheStrategy cacheStrategy
protected String[] cacheGroups
protected Map<String,Object> parameters
protected CapsStrategy columnNameCaps
protected int limit
protected int offset
protected int pageSize
protected int statementFetchSize
Constructor Detail |
---|
public SQLSelect(String sql)
public SQLSelect(Class<T> persistentType, String sql)
Method Detail |
---|
public static SQLSelect<DataRow> dataRowQuery(String sql)
public static SQLSelect<DataRow> dataRowQuery(String dataMapName, String sql)
public static <T> SQLSelect<T> query(Class<T> type, String sql)
public static <T> SQLSelect<T> scalarQuery(Class<T> type, String sql)
public static <T> SQLSelect<T> scalarQuery(Class<T> type, String dataMapName, String sql)
public List<T> select(ObjectContext context)
public T selectOne(ObjectContext context)
public boolean isFetchingDataRows()
public boolean isFetchingScalars()
public String getSql()
public SQLSelect<T> append(String sqlChunk)
public SQLSelect<T> bind(String name, Object value)
public Map<String,Object> getParameters()
bind(String, Object)
protected Query createReplacementQuery(EntityResolver resolver)
IndirectQuery
createReplacementQuery
in class IndirectQuery
public void useLocalCache(String... cacheGroups)
query.setCacheStrategy(QueryCacheStrategy.LOCAL_CACHE); query.setCacheGroups("group1", "group2");
public SQLSelect<T> useSharedCache(String... cacheGroups)
query.setCacheStrategy(QueryCacheStrategy.SHARED_CACHE); query.setCacheGroups("group1", "group2");
public QueryCacheStrategy getCacheStrategy()
public SQLSelect<T> cacheStrategy(QueryCacheStrategy strategy)
public String[] getCacheGroups()
public SQLSelect<T> cacheGroups(String... cacheGroups)
public CapsStrategy getColumnNameCaps()
public SQLSelect<T> columnNameCaps(CapsStrategy columnNameCaps)
public SQLSelect<T> upperColumnNames()
CapsStrategy.UPPER
public SQLSelect<T> lowerColumnNames()
CapsStrategy.LOWER
public int getLimit()
public SQLSelect<T> limit(int fetchLimit)
public int getOffset()
public SQLSelect<T> offset(int fetchOffset)
public int getPageSize()
public SQLSelect<T> pageSize(int pageSize)
public SQLSelect<T> statementFetchSize(int size)
public int getStatementFetchSize()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |