Package org.apache.cayenne.access.jdbc
Class SQLTemplateAction
java.lang.Object
org.apache.cayenne.access.jdbc.SQLTemplateAction
- All Implemented Interfaces:
- SQLAction
public class SQLTemplateAction extends Object implements SQLAction
Implements a strategy for execution of SQLTemplates.
- Since:
- 1.2 replaces SQLTemplateExecutionPlan
- 
Field SummaryFields Modifier and Type Field Description protected DataNodedataNodeprotected DbAdapterdbAdapterprotected DbEntitydbEntityprotected SQLTemplatequeryprotected QueryMetadataqueryMetadata
- 
Constructor SummaryConstructors Constructor Description SQLTemplateAction(SQLTemplate query, DataNode dataNode)
- 
Method SummaryModifier and Type Method Description protected voidbind(PreparedStatement preparedStatement, ParameterBinding[] bindings)Binds parameters to the PreparedStatement.protected RowDescriptorBuilderconfigureRowDescriptorBuilder(SQLStatement compiled, ResultSet resultSet)protected voidexecute(Connection connection, OperationObserver callback, SQLStatement compiled, Collection<Number> updateCounts)protected StringextractTemplateString()Extracts a template string from a SQLTemplate query.DbAdaptergetAdapter()Returns unwrapped DbAdapter used to find correct SQL for a given DB.protected intgetFetchOffset()SQLTemplategetQuery()Returns a SQLTemplate for this action.voidperformAction(Connection connection, OperationObserver callback)Runs a SQLTemplate query, collecting all results.protected voidprocessSelectResult(SQLStatement compiled, Connection connection, Statement statement, ResultSet resultSet, OperationObserver callback, long startTime)
- 
Field Details- 
query
- 
queryMetadata
- 
dbEntity
- 
dataNode
- 
dbAdapter
 
- 
- 
Constructor Details- 
SQLTemplateAction- Since:
- 4.0
 
 
- 
- 
Method Details- 
getAdapterReturns unwrapped DbAdapter used to find correct SQL for a given DB.
- 
performActionpublic void performAction(Connection connection, OperationObserver callback) throws SQLException, ExceptionRuns a SQLTemplate query, collecting all results. If a callback expects an iterated result, result processing is stopped after the first ResultSet is encountered.- Specified by:
- performActionin interface- SQLAction
- Throws:
- SQLException
- Exception
 
- 
executeprotected void execute(Connection connection, OperationObserver callback, SQLStatement compiled, Collection<Number> updateCounts) throws SQLException, Exception- Throws:
- SQLException
- Exception
 
- 
processSelectResultprotected void processSelectResult(SQLStatement compiled, Connection connection, Statement statement, ResultSet resultSet, OperationObserver callback, long startTime) throws Exception- Throws:
- Exception
 
- 
configureRowDescriptorBuilderprotected RowDescriptorBuilder configureRowDescriptorBuilder(SQLStatement compiled, ResultSet resultSet) throws SQLException- Throws:
- SQLException
- Since:
- 3.0
 
- 
extractTemplateStringExtracts a template string from a SQLTemplate query. Exists mainly for the benefit of subclasses that can customize returned template.- Since:
- 1.2
 
- 
bindprotected void bind(PreparedStatement preparedStatement, ParameterBinding[] bindings) throws SQLException, ExceptionBinds parameters to the PreparedStatement.- Throws:
- SQLException
- Exception
 
- 
getQueryReturns a SQLTemplate for this action.
- 
getFetchOffsetprotected int getFetchOffset()- Since:
- 3.0
 
 
-