use of org.hibernate.sql.exec.spi.JdbcMutationExecutor in project hibernate-orm by hibernate.
the class NativeNonSelectQueryPlanImpl method executeUpdate.
@Override
public int executeUpdate(DomainQueryExecutionContext executionContext) {
executionContext.getSession().autoFlushIfRequired(affectedTableNames);
BulkOperationCleanupAction.schedule(executionContext.getSession(), affectedTableNames);
final List<JdbcParameterBinder> jdbcParameterBinders;
final JdbcParameterBindings jdbcParameterBindings;
final QueryParameterBindings queryParameterBindings = executionContext.getQueryParameterBindings();
if (parameterList == null || parameterList.isEmpty()) {
jdbcParameterBinders = Collections.emptyList();
jdbcParameterBindings = JdbcParameterBindings.NO_BINDINGS;
} else {
jdbcParameterBinders = new ArrayList<>(parameterList.size());
jdbcParameterBindings = new JdbcParameterBindingsImpl(parameterList.size());
jdbcParameterBindings.registerNativeQueryParameters(queryParameterBindings, parameterList, jdbcParameterBinders, executionContext.getSession().getFactory());
}
final JdbcMutation jdbcMutation = new NativeJdbcMutation(sql, jdbcParameterBinders, affectedTableNames);
final JdbcMutationExecutor executor = StandardJdbcMutationExecutor.INSTANCE;
final SharedSessionContractImplementor session = executionContext.getSession();
// return jdbcServices.getJdbcMutationExecutor().execute(
return executor.execute(jdbcMutation, jdbcParameterBindings, sql -> session.getJdbcCoordinator().getStatementPreparer().prepareStatement(sql), (integer, preparedStatement) -> {
}, SqmJdbcExecutionContextAdapter.usingLockingAndPaging(executionContext));
}
Aggregations