1 19 20 package org.apache.cayenne.dba.sqlserver; 21 22 import org.apache.cayenne.access.jdbc.BatchAction; 23 import org.apache.cayenne.dba.DbAdapter; 24 import org.apache.cayenne.dba.JdbcActionBuilder; 25 import org.apache.cayenne.map.EntityResolver; 26 import org.apache.cayenne.query.BatchQuery; 27 import org.apache.cayenne.query.ProcedureQuery; 28 import org.apache.cayenne.query.SQLAction; 29 30 34 public class SQLServerActionBuilder extends JdbcActionBuilder { 35 36 public SQLServerActionBuilder(DbAdapter adapter, EntityResolver resolver) { 37 super(adapter, resolver); 38 } 39 40 public SQLAction batchAction(BatchQuery query) { 41 43 boolean useOptimisticLock = query.isUsingOptimisticLocking(); 45 46 boolean runningAsBatch = !useOptimisticLock && adapter.supportsBatchUpdates(); 47 BatchAction action = new SQLServerBatchAction(query, adapter, entityResolver); 48 action.setBatch(runningAsBatch); 49 return action; 50 } 51 52 public SQLAction procedureAction(ProcedureQuery query) { 53 return new SQLServerProcedureAction(query, getAdapter(), getEntityResolver()); 54 } 55 } 56 | Popular Tags |