Search in sources :

Example 1 with JdbcSelectExecutor

use of org.hibernate.sql.exec.spi.JdbcSelectExecutor 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);
}
Also used : JdbcSelect(org.hibernate.sql.exec.spi.JdbcSelect) JdbcParameterBindingsImpl(org.hibernate.sql.exec.internal.JdbcParameterBindingsImpl) QueryParameterBindings(org.hibernate.query.spi.QueryParameterBindings) JdbcParameterBinder(org.hibernate.sql.exec.spi.JdbcParameterBinder) JdbcSelectExecutor(org.hibernate.sql.exec.spi.JdbcSelectExecutor) JdbcParameterBindings(org.hibernate.sql.exec.spi.JdbcParameterBindings)

Example 2 with JdbcSelectExecutor

use of org.hibernate.sql.exec.spi.JdbcSelectExecutor 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);
}
Also used : JdbcSelect(org.hibernate.sql.exec.spi.JdbcSelect) JdbcParameterBindingsImpl(org.hibernate.sql.exec.internal.JdbcParameterBindingsImpl) QueryParameterBindings(org.hibernate.query.spi.QueryParameterBindings) JdbcParameterBinder(org.hibernate.sql.exec.spi.JdbcParameterBinder) JdbcSelectExecutor(org.hibernate.sql.exec.spi.JdbcSelectExecutor) JdbcParameterBindings(org.hibernate.sql.exec.spi.JdbcParameterBindings)

Aggregations

QueryParameterBindings (org.hibernate.query.spi.QueryParameterBindings)2 JdbcParameterBindingsImpl (org.hibernate.sql.exec.internal.JdbcParameterBindingsImpl)2 JdbcParameterBinder (org.hibernate.sql.exec.spi.JdbcParameterBinder)2 JdbcParameterBindings (org.hibernate.sql.exec.spi.JdbcParameterBindings)2 JdbcSelect (org.hibernate.sql.exec.spi.JdbcSelect)2 JdbcSelectExecutor (org.hibernate.sql.exec.spi.JdbcSelectExecutor)2