Class DefaultBatchTranslator
java.lang.Object
org.apache.cayenne.access.translator.batch.DefaultBatchTranslator
- All Implemented Interfaces:
BatchTranslator
- Direct Known Subclasses:
DeleteBatchTranslator,InsertBatchTranslator,UpdateBatchTranslator
public abstract class DefaultBatchTranslator extends Object implements BatchTranslator
Superclass of batch query translators.
- Since:
- 4.0
-
Field Summary
Fields Modifier and Type Field Description protected DbAdapteradapterprotected DbAttributeBinding[]bindingsprotected BatchQueryqueryprotected Stringsqlprotected booleantranslatedprotected StringtrimFunction -
Constructor Summary
Constructors Constructor Description DefaultBatchTranslator(BatchQuery query, DbAdapter adapter, String trimFunction) -
Method Summary
Modifier and Type Method Description protected voidappendDbAttribute(StringBuilder buf, DbAttribute dbAttribute)Appends the name of the column to the query buffer.protected abstract DbAttributeBinding[]createBindings()protected abstract StringcreateSql()protected abstract DbAttributeBinding[]doUpdateBindings(BatchQueryRow row)protected voidensureTranslated()DbAttributeBinding[]getBindings()Returns the widest possible array of bindings for this query.StringgetSql()Translates BatchQuery into an SQL string formatted to use in a PreparedStatement.DbAttributeBinding[]updateBindings(BatchQueryRow row)Updates internal bindings to be used with a given row, returning updated bindings array.
-
Field Details
-
query
-
adapter
-
trimFunction
-
translated
protected boolean translated -
sql
-
bindings
-
-
Constructor Details
-
DefaultBatchTranslator
-
-
Method Details
-
ensureTranslated
protected void ensureTranslated() -
getSql
Translates BatchQuery into an SQL string formatted to use in a PreparedStatement.- Specified by:
getSqlin interfaceBatchTranslator
-
getBindings
Description copied from interface:BatchTranslatorReturns the widest possible array of bindings for this query.- Specified by:
getBindingsin interfaceBatchTranslator
-
updateBindings
Description copied from interface:BatchTranslatorUpdates internal bindings to be used with a given row, returning updated bindings array. This method guarantees that the returned array contains the same bindings in the same order as in the array returned fromBatchTranslator.getBindings()(but in a state corresponding to the 'row' parameter). Usually the returned array is actually the same object reused for every iteration, only with changed object state.- Specified by:
updateBindingsin interfaceBatchTranslator
-
createSql
-
createBindings
-
doUpdateBindings
-
appendDbAttribute
Appends the name of the column to the query buffer. Subclasses use this method to append column names in the WHERE clause, i.e. for the columns that are not being updated.
-