use of org.hibernate.sql.exec.spi.JdbcParameterBinder in project hibernate-orm by hibernate.
the class NativeSelectQueryPlanImpl method performScroll.
@Override
public ScrollableResultsImplementor<R> performScroll(ScrollMode scrollMode, DomainQueryExecutionContext executionContext) {
if (executionContext.getQueryOptions().getEffectiveLimit().getMaxRowsJpa() == 0) {
return EmptyScrollableResults.INSTANCE;
}
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 JdbcSelect jdbcSelect = new JdbcSelect(sql, jdbcParameterBinders, resultSetMapping, affectedTableNames, Collections.emptySet());
final JdbcSelectExecutor executor = JdbcSelectExecutorStandardImpl.INSTANCE;
// return jdbcServices.getJdbcSelectExecutor().scroll(
return executor.scroll(jdbcSelect, scrollMode, jdbcParameterBindings, SqmJdbcExecutionContextAdapter.usingLockingAndPaging(executionContext), null);
}
use of org.hibernate.sql.exec.spi.JdbcParameterBinder in project hibernate-orm by hibernate.
the class NativeSelectQueryPlanImpl method performList.
@Override
public List<R> performList(DomainQueryExecutionContext executionContext) {
if (executionContext.getQueryOptions().getEffectiveLimit().getMaxRowsJpa() == 0) {
return Collections.emptyList();
}
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());
}
executionContext.getSession().autoFlushIfRequired(affectedTableNames);
final JdbcSelect jdbcSelect = new JdbcSelect(sql, jdbcParameterBinders, resultSetMapping, affectedTableNames, Collections.emptySet());
final JdbcSelectExecutor executor = JdbcSelectExecutorStandardImpl.INSTANCE;
// return jdbcServices.getJdbcSelectExecutor().execute(
return executor.list(jdbcSelect, jdbcParameterBindings, SqmJdbcExecutionContextAdapter.usingLockingAndPaging(executionContext), null, ListResultsConsumer.UniqueSemantic.NONE);
}
Aggregations