Cayenne allows plugging user-defined behavior to the process of performing commit actions in ObjectContext. Imagine situation when you need to perform UPDATE queries to mark records in database as deleted, instead of using common DELETE queries, e.g. something like

    UPDATE ARTIST SET DELETED = true WHERE ARTIST_ID = 1987

instead of

    DELETE FROM ARTIST WHERE ARTIST_ID = 1987

In such cases you need to intercept Cayenne's process of generating SQL queries. This can be obtained by providing custom `org.apache.cayenne.access.jdbc.BatchQueryBuilderFactory` to a DataDomain, for example:

    DataDomain domain = Configuration.getSharedConfiguration().getDomain();
    domain.setQueryBuilderFactory(new SoftDeleteQueryBuilderFactory());

`org.apache.cayenne.access.jdbc.SoftDeleteQueryBuilderFactory` is a custom factory built into Cayenne which replaces DELETE queries with UPDATEs as described above.

You can plug in your own factories. BatchQueryBuilderFactory interface is very simple and contains methods for creating query builders for objects that were inserted, updated or deleted:

    public BatchQueryBuilder createInsertQueryBuilder(DbAdapter adapter);
    public BatchQueryBuilder createUpdateQueryBuilder(DbAdapter adapter);
    public BatchQueryBuilder createDeleteQueryBuilder(DbAdapter adapter);

Note that BatchQueryBuilder factory only affects queries being created during commit for NEW, MODIFIED or DELETED objects in ObjectContext. It has no effect on database modifications that are made with, say, EJBQLQuery or SQLTemplate.