Class TableBasedUpdateHandler
java.lang.Object
org.hibernate.query.sqm.mutation.internal.AbstractMutationHandler
org.hibernate.query.sqm.mutation.internal.temptable.TableBasedUpdateHandler
- All Implemented Interfaces:
Handler
,UpdateHandler
,MultiTableHandler
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final record
-
Constructor Summary
ConstructorsConstructorDescriptionTableBasedUpdateHandler
(SqmUpdateStatement<?> sqmUpdate, DomainParameterXref domainParameterXref, TemporaryTable idTable, TemporaryTableStrategy temporaryTableStrategy, boolean forceDropAfterUse, Function<SharedSessionContractImplementor, String> sessionUidAccess, DomainQueryExecutionContext context, MutableObject<JdbcParameterBindings> firstJdbcParameterBindingsConsumer) -
Method Summary
Modifier and TypeMethodDescriptionprotected Expression
asExpression
(SelectClause selectClause) protected void
collectTableReference
(TableReferenceJoin tableReferenceJoin, BiConsumer<String, TableReference> consumer) protected void
collectTableReference
(TableReference tableReference, BiConsumer<String, TableReference> consumer) protected QuerySpec
createExistsSubQuerySpec
(String targetTableExpression, Supplier<Consumer<SelectableConsumer>> tableKeyColumnVisitationSupplier, QuerySpec idTableSubQuery, SessionFactoryImplementor sessionFactory) Create theJdbcParameterBindings
for this multi-table handler based on the execution context.boolean
Signals that the SQL depends on the parameter bindings e.g.int
execute
(JdbcParameterBindings jdbcParameterBindings, DomainQueryExecutionContext context) Execute the multi-table update or delete indicated by the SQM AST passed in when this Handler was created.protected AfterUseAction
protected TemporaryTable
protected Function
<SharedSessionContractImplementor, String> protected @Nullable JdbcParameter
protected List
<TableBasedUpdateHandler.TableUpdater> protected TemporaryTableStrategy
boolean
isCompatibleWith
(JdbcParameterBindings jdbcParameterBindings, QueryOptions queryOptions) protected boolean
isTableOptional
(String tableExpression) protected static QuerySpec
makeInsertSourceSelectQuerySpec
(QuerySpec idTableSubQuery) protected Expression
resolveMutatingTableKeyExpression
(String tableExpression, Supplier<Consumer<SelectableConsumer>> tableKeyColumnVisitationSupplier) protected TableReference
resolveTableReference
(ColumnReference columnReference, Map<String, TableReference> tableReferenceByAlias) protected NamedTableReference
resolveUnionTableReference
(TableReference tableReference, String tableExpression) Methods inherited from class org.hibernate.query.sqm.mutation.internal.AbstractMutationHandler
getEntityDescriptor, getSessionFactory, getSqmStatement
-
Constructor Details
-
TableBasedUpdateHandler
public TableBasedUpdateHandler(SqmUpdateStatement<?> sqmUpdate, DomainParameterXref domainParameterXref, TemporaryTable idTable, TemporaryTableStrategy temporaryTableStrategy, boolean forceDropAfterUse, Function<SharedSessionContractImplementor, String> sessionUidAccess, DomainQueryExecutionContext context, MutableObject<JdbcParameterBindings> firstJdbcParameterBindingsConsumer)
-
-
Method Details
-
createJdbcParameterBindings
Description copied from interface:MultiTableHandler
Create theJdbcParameterBindings
for this multi-table handler based on the execution context.- Specified by:
createJdbcParameterBindings
in interfaceMultiTableHandler
- Parameters:
context
- Contextual information needed for execution- Returns:
- The built parameter bindings
-
dependsOnParameterBindings
public boolean dependsOnParameterBindings()Description copied from interface:MultiTableHandler
Signals that the SQL depends on the parameter bindings e.g. due to the need for inlining of parameter values or multiValued parameters.- Specified by:
dependsOnParameterBindings
in interfaceHandler
- Specified by:
dependsOnParameterBindings
in interfaceMultiTableHandler
-
isCompatibleWith
public boolean isCompatibleWith(JdbcParameterBindings jdbcParameterBindings, QueryOptions queryOptions) - Specified by:
isCompatibleWith
in interfaceHandler
- Specified by:
isCompatibleWith
in interfaceMultiTableHandler
-
resolveTableReference
protected TableReference resolveTableReference(ColumnReference columnReference, Map<String, TableReference> tableReferenceByAlias) -
resolveUnionTableReference
protected NamedTableReference resolveUnionTableReference(TableReference tableReference, String tableExpression) -
isTableOptional
-
createExistsSubQuerySpec
protected QuerySpec createExistsSubQuerySpec(String targetTableExpression, Supplier<Consumer<SelectableConsumer>> tableKeyColumnVisitationSupplier, QuerySpec idTableSubQuery, SessionFactoryImplementor sessionFactory) -
makeInsertSourceSelectQuerySpec
-
resolveMutatingTableKeyExpression
protected Expression resolveMutatingTableKeyExpression(String tableExpression, Supplier<Consumer<SelectableConsumer>> tableKeyColumnVisitationSupplier) -
asExpression
-
collectTableReference
protected void collectTableReference(TableReference tableReference, BiConsumer<String, TableReference> consumer) -
collectTableReference
protected void collectTableReference(TableReferenceJoin tableReferenceJoin, BiConsumer<String, TableReference> consumer) -
execute
public int execute(JdbcParameterBindings jdbcParameterBindings, DomainQueryExecutionContext context) Description copied from interface:MultiTableHandler
Execute the multi-table update or delete indicated by the SQM AST passed in when this Handler was created.- Specified by:
execute
in interfaceMultiTableHandler
- Parameters:
jdbcParameterBindings
- The parameter bindings for JDBC parameterscontext
- Contextual information needed for execution- Returns:
- The "number of rows affected" count
-
getTableUpdaters
-
getAfterUseAction
-
getIdTable
-
getTemporaryTableStrategy
-
getMatchingIdsIntoIdTableInsert
protected CacheableSqmInterpretation<InsertSelectStatement,JdbcOperationQueryMutation> getMatchingIdsIntoIdTableInsert() -
getSessionUidAccess
-
getSessionUidParameter
-