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