org.apache.cayenne.access.jdbc
Class SoftDeleteBatchQueryBuilder

java.lang.Object
  extended by org.apache.cayenne.access.trans.BatchQueryBuilder
      extended by org.apache.cayenne.access.trans.DeleteBatchQueryBuilder
          extended by org.apache.cayenne.access.jdbc.SoftDeleteBatchQueryBuilder

public class SoftDeleteBatchQueryBuilder
extends DeleteBatchQueryBuilder

Implementation of DeleteBatchQueryBuilder, which uses 'soft' delete (runs UPDATE and sets 'deleted' field to true instead-of running SQL DELETE)


Field Summary
 
Fields inherited from class org.apache.cayenne.access.trans.BatchQueryBuilder
adapter, trimFunction
 
Constructor Summary
SoftDeleteBatchQueryBuilder(DbAdapter adapter, String deletedFieldName)
           
 
Method Summary
 void bindParameters(PreparedStatement statement, BatchQuery query)
          Binds BatchQuery parameters to the PreparedStatement.
 String createSqlString(BatchQuery batch)
          Translates BatchQuery into an SQL string formatted to use in a PreparedStatement.
protected  int getFirstParameterIndex(BatchQuery query)
           
protected  boolean needSoftDelete(BatchQuery query)
           
 
Methods inherited from class org.apache.cayenne.access.trans.DeleteBatchQueryBuilder
applyQualifier
 
Methods inherited from class org.apache.cayenne.access.trans.BatchQueryBuilder
appendDbAttribute, getAdapter, getParameterValues, getTrimFunction, setAdapter, setTrimFunction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SoftDeleteBatchQueryBuilder

public SoftDeleteBatchQueryBuilder(DbAdapter adapter,
                                   String deletedFieldName)
Method Detail

createSqlString

public String createSqlString(BatchQuery batch)
                       throws IOException
Description copied from class: BatchQueryBuilder
Translates BatchQuery into an SQL string formatted to use in a PreparedStatement.

Overrides:
createSqlString in class DeleteBatchQueryBuilder
Throws:
IOException

getFirstParameterIndex

protected int getFirstParameterIndex(BatchQuery query)
Overrides:
getFirstParameterIndex in class DeleteBatchQueryBuilder
Returns:
index of first parameter in delete clause

bindParameters

public void bindParameters(PreparedStatement statement,
                           BatchQuery query)
                    throws SQLException,
                           Exception
Description copied from class: DeleteBatchQueryBuilder
Binds BatchQuery parameters to the PreparedStatement.

Overrides:
bindParameters in class DeleteBatchQueryBuilder
Throws:
SQLException
Exception

needSoftDelete

protected boolean needSoftDelete(BatchQuery query)
Returns:
whether 'soft' deletion should be used


Copyright © 2001-2011 Apache Cayenne. All Rights Reserved.