parent
aef0775946
commit
a3c36af5c6
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
package org.hibernate.loader.ast.internal;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ public class NativeNonSelectQueryPlanImpl implements NonSelectQueryPlan {
|
|||
.getStatementPreparer()
|
||||
.prepareStatement( sql ),
|
||||
(integer, preparedStatement) -> {},
|
||||
new SqmJdbcExecutionContextAdapter( executionContext )
|
||||
SqmJdbcExecutionContextAdapter.usingLockingAndPaging( executionContext )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ public class NativeSelectQueryPlanImpl<R> implements NativeSelectQueryPlan<R> {
|
|||
return executor.list(
|
||||
jdbcSelect,
|
||||
jdbcParameterBindings,
|
||||
new SqmJdbcExecutionContextAdapter( executionContext, executionContext.getQueryOptions() ),
|
||||
SqmJdbcExecutionContextAdapter.usingLockingAndPaging( executionContext ),
|
||||
null,
|
||||
ListResultsConsumer.UniqueSemantic.NONE
|
||||
);
|
||||
|
@ -192,7 +192,7 @@ public class NativeSelectQueryPlanImpl<R> implements NativeSelectQueryPlan<R> {
|
|||
jdbcSelect,
|
||||
scrollMode,
|
||||
jdbcParameterBindings,
|
||||
new SqmJdbcExecutionContextAdapter( executionContext, executionContext.getQueryOptions() ),
|
||||
SqmJdbcExecutionContextAdapter.usingLockingAndPaging( executionContext ),
|
||||
null
|
||||
);
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ public class SimpleDeleteQueryPlan implements NonSelectQueryPlan {
|
|||
assert jdbcParamsXref.isEmpty();
|
||||
}
|
||||
|
||||
final SqmJdbcExecutionContextAdapter executionContextAdapter = new SqmJdbcExecutionContextAdapter( executionContext );
|
||||
final SqmJdbcExecutionContextAdapter executionContextAdapter = SqmJdbcExecutionContextAdapter.usingLockingAndPaging( executionContext );
|
||||
|
||||
SqmMutationStrategyHelper.cleanUpCollectionTables(
|
||||
entityDescriptor,
|
||||
|
|
|
@ -123,7 +123,7 @@ public class SimpleInsertQueryPlan implements NonSelectQueryPlan {
|
|||
.getStatementPreparer()
|
||||
.prepareStatement( sql ),
|
||||
(integer, preparedStatement) -> {},
|
||||
new SqmJdbcExecutionContextAdapter( executionContext )
|
||||
SqmJdbcExecutionContextAdapter.omittingLockingAndPaging( executionContext )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ public class SimpleUpdateQueryPlan implements NonSelectQueryPlan {
|
|||
.getStatementPreparer()
|
||||
.prepareStatement( sql ),
|
||||
(integer, preparedStatement) -> {},
|
||||
new SqmJdbcExecutionContextAdapter( executionContext )
|
||||
SqmJdbcExecutionContextAdapter.omittingLockingAndPaging( executionContext )
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,25 +17,38 @@ import org.hibernate.sql.exec.spi.JdbcSelect;
|
|||
import static org.hibernate.query.spi.SqlOmittingQueryOptions.omitSqlQueryOptions;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
* ExecutionContext adapter delegating to a DomainQueryExecutionContext
|
||||
*/
|
||||
public class SqmJdbcExecutionContextAdapter implements ExecutionContext {
|
||||
/**
|
||||
* Creates an adapter which drops any locking or paging details from the query options
|
||||
*/
|
||||
public static SqmJdbcExecutionContextAdapter omittingLockingAndPaging(DomainQueryExecutionContext sqmExecutionContext) {
|
||||
return new SqmJdbcExecutionContextAdapter( sqmExecutionContext );
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an adapter which honors any locking or paging details specified in the query options
|
||||
*/
|
||||
public static SqmJdbcExecutionContextAdapter usingLockingAndPaging(DomainQueryExecutionContext sqmExecutionContext) {
|
||||
return new SqmJdbcExecutionContextAdapter( sqmExecutionContext, sqmExecutionContext.getQueryOptions() );
|
||||
}
|
||||
|
||||
private final DomainQueryExecutionContext sqmExecutionContext;
|
||||
private final QueryOptions queryOptions;
|
||||
|
||||
public SqmJdbcExecutionContextAdapter(DomainQueryExecutionContext sqmExecutionContext) {
|
||||
private SqmJdbcExecutionContextAdapter(DomainQueryExecutionContext sqmExecutionContext) {
|
||||
this( sqmExecutionContext, omitSqlQueryOptions( sqmExecutionContext.getQueryOptions() ) );
|
||||
}
|
||||
|
||||
private SqmJdbcExecutionContextAdapter(DomainQueryExecutionContext sqmExecutionContext, QueryOptions queryOptions) {
|
||||
this.sqmExecutionContext = sqmExecutionContext;
|
||||
this.queryOptions = queryOptions;
|
||||
}
|
||||
|
||||
public SqmJdbcExecutionContextAdapter(DomainQueryExecutionContext sqmExecutionContext, JdbcSelect jdbcSelect) {
|
||||
this( sqmExecutionContext, omitSqlQueryOptions( sqmExecutionContext.getQueryOptions(), jdbcSelect ) );
|
||||
}
|
||||
|
||||
public SqmJdbcExecutionContextAdapter(DomainQueryExecutionContext sqmExecutionContext, QueryOptions queryOptions) {
|
||||
this.sqmExecutionContext = sqmExecutionContext;
|
||||
this.queryOptions = queryOptions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedSessionContractImplementor getSession() {
|
||||
return sqmExecutionContext.getSession();
|
||||
|
|
|
@ -275,7 +275,7 @@ public class MatchingIdSelectionHelper {
|
|||
return jdbcServices.getJdbcSelectExecutor().list(
|
||||
idSelectJdbcOperation,
|
||||
jdbcParameterBindings,
|
||||
new SqmJdbcExecutionContextAdapter( executionContext ),
|
||||
SqmJdbcExecutionContextAdapter.omittingLockingAndPaging( executionContext ),
|
||||
row -> row,
|
||||
ListResultsConsumer.UniqueSemantic.FILTER
|
||||
);
|
||||
|
|
|
@ -206,7 +206,7 @@ public abstract class AbstractCteMutationHandler extends AbstractMutationHandler
|
|||
List<Object> list = jdbcServices.getJdbcSelectExecutor().list(
|
||||
select,
|
||||
jdbcParameterBindings,
|
||||
new SqmJdbcExecutionContextAdapter( executionContext ),
|
||||
SqmJdbcExecutionContextAdapter.omittingLockingAndPaging( executionContext ),
|
||||
row -> row[0],
|
||||
ListResultsConsumer.UniqueSemantic.NONE
|
||||
);
|
||||
|
|
|
@ -34,7 +34,6 @@ import org.hibernate.persister.entity.Joinable;
|
|||
import org.hibernate.query.spi.DomainQueryExecutionContext;
|
||||
import org.hibernate.query.spi.QueryOptions;
|
||||
import org.hibernate.query.spi.QueryParameterBindings;
|
||||
import org.hibernate.query.spi.SqlOmittingQueryOptions;
|
||||
import org.hibernate.query.sqm.internal.DomainParameterXref;
|
||||
import org.hibernate.query.sqm.internal.SqmJdbcExecutionContextAdapter;
|
||||
import org.hibernate.query.sqm.internal.SqmUtil;
|
||||
|
@ -178,7 +177,7 @@ public class RestrictedDeleteExecutionDelegate implements TableBasedDeleteHandle
|
|||
|
||||
boolean needsIdTable = needsIdTableWrapper.get();
|
||||
|
||||
final SqmJdbcExecutionContextAdapter executionContextAdapter = new SqmJdbcExecutionContextAdapter( executionContext );
|
||||
final SqmJdbcExecutionContextAdapter executionContextAdapter = SqmJdbcExecutionContextAdapter.omittingLockingAndPaging( executionContext );
|
||||
|
||||
if ( needsIdTable ) {
|
||||
return executeWithIdTable(
|
||||
|
|
|
@ -110,7 +110,7 @@ public class TableBasedUpdateHandler
|
|||
);
|
||||
}
|
||||
|
||||
final SqmJdbcExecutionContextAdapter executionContextAdapter = new SqmJdbcExecutionContextAdapter( executionContext );
|
||||
final SqmJdbcExecutionContextAdapter executionContextAdapter = SqmJdbcExecutionContextAdapter.omittingLockingAndPaging( executionContext );
|
||||
return resolveDelegate( executionContext ).execute( executionContextAdapter );
|
||||
}
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ public class InlineDeleteHandler implements DeleteHandler {
|
|||
sessionFactory
|
||||
);
|
||||
|
||||
final SqmJdbcExecutionContextAdapter executionContextAdapter = new SqmJdbcExecutionContextAdapter( executionContext );
|
||||
final SqmJdbcExecutionContextAdapter executionContextAdapter = SqmJdbcExecutionContextAdapter.omittingLockingAndPaging( executionContext );
|
||||
|
||||
final Predicate matchingIdsPredicate = matchingIdsPredicateProducer.produceRestriction(
|
||||
ids,
|
||||
|
|
Loading…
Reference in New Issue