Search in sources :

Example 21 with JdbcSelect

use of org.hibernate.sql.exec.spi.JdbcSelect 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

JdbcSelect (org.hibernate.sql.exec.spi.JdbcSelect)21 JdbcParameterBindings (org.hibernate.sql.exec.spi.JdbcParameterBindings)17 JdbcServices (org.hibernate.engine.jdbc.spi.JdbcServices)16 SessionFactoryImplementor (org.hibernate.engine.spi.SessionFactoryImplementor)14 SelectStatement (org.hibernate.sql.ast.tree.select.SelectStatement)14 JdbcEnvironment (org.hibernate.engine.jdbc.env.spi.JdbcEnvironment)13 JdbcParameterBindingsImpl (org.hibernate.sql.exec.internal.JdbcParameterBindingsImpl)13 SharedSessionContractImplementor (org.hibernate.engine.spi.SharedSessionContractImplementor)12 QueryParameterBindings (org.hibernate.query.spi.QueryParameterBindings)12 SqlAstTranslatorFactory (org.hibernate.sql.ast.SqlAstTranslatorFactory)12 ArrayList (java.util.ArrayList)11 ExecutionContext (org.hibernate.sql.exec.spi.ExecutionContext)11 QueryOptions (org.hibernate.query.spi.QueryOptions)10 Callback (org.hibernate.sql.exec.spi.Callback)10 JdbcParameter (org.hibernate.sql.ast.tree.expression.JdbcParameter)9 TableGroup (org.hibernate.sql.ast.tree.from.TableGroup)6 List (java.util.List)5 EntityKey (org.hibernate.engine.spi.EntityKey)5 SubselectFetch (org.hibernate.engine.spi.SubselectFetch)5 MappingModelExpressible (org.hibernate.metamodel.mapping.MappingModelExpressible)5