Get rid of some capturing lambdas

This commit is contained in:
Christian Beikov 2023-01-24 14:51:51 +01:00
parent 420e561f21
commit e841b0aaae
16 changed files with 324 additions and 216 deletions

View File

@ -143,7 +143,7 @@ public class ManyToManyCollectionPart extends AbstractEntityCollectionPart imple
@Override @Override
public SelectableMapping getSelectable(int columnIndex) { public SelectableMapping getSelectable(int columnIndex) {
return fkTargetModelPart.getSelectable( columnIndex ); return foreignKey.getKeyPart().getSelectable( columnIndex );
} }
@Override @Override

View File

@ -454,21 +454,16 @@ public class BasicCollectionPersister extends AbstractCollectionPersister {
// WHERE // WHERE
if ( attribute.getIdentifierDescriptor() != null ) { if ( attribute.getIdentifierDescriptor() != null ) {
attribute.getIdentifierDescriptor().forEachSelectable( updateBuilder::addKeyRestrictionLeniently ); updateBuilder.addKeyRestrictionsLeniently( attribute.getIdentifierDescriptor() );
} }
else { else {
attribute.getKeyDescriptor().getKeyPart().forEachSelectable( updateBuilder::addKeyRestrictionLeniently ); updateBuilder.addKeyRestrictionsLeniently( attribute.getKeyDescriptor().getKeyPart() );
if ( attribute.getIndexDescriptor() != null && !indexContainsFormula ) { if ( attribute.getIndexDescriptor() != null && !indexContainsFormula ) {
attribute.getIndexDescriptor().forEachSelectable( updateBuilder::addKeyRestrictionLeniently ); updateBuilder.addKeyRestrictionsLeniently( attribute.getIndexDescriptor() );
} }
else { else {
attribute.getElementDescriptor().forEachSelectable( (selectionIndex, selectableMapping) -> { updateBuilder.addKeyRestrictions( attribute.getElementDescriptor() );
if ( selectableMapping.isFormula() ) {
return;
}
updateBuilder.addKeyRestriction( selectableMapping );
} );
} }
} }
@ -597,24 +592,17 @@ public class BasicCollectionPersister extends AbstractCollectionPersister {
final TableDeleteBuilderStandard deleteBuilder = new TableDeleteBuilderStandard( this, tableReference, getFactory() ); final TableDeleteBuilderStandard deleteBuilder = new TableDeleteBuilderStandard( this, tableReference, getFactory() );
if ( pluralAttribute.getIdentifierDescriptor() != null ) { if ( pluralAttribute.getIdentifierDescriptor() != null ) {
deleteBuilder.addKeyRestrictionLeniently( pluralAttribute.getIdentifierDescriptor() ); deleteBuilder.addKeyRestrictionsLeniently( pluralAttribute.getIdentifierDescriptor() );
} }
else { else {
pluralAttribute deleteBuilder.addKeyRestrictionsLeniently( pluralAttribute.getKeyDescriptor().getKeyPart() );
.getKeyDescriptor()
.getKeyPart()
.forEachSelectable( deleteBuilder::addKeyRestrictionLeniently );
if ( hasIndex && !indexContainsFormula ) { if ( hasIndex && !indexContainsFormula ) {
assert pluralAttribute.getIndexDescriptor() != null; assert pluralAttribute.getIndexDescriptor() != null;
pluralAttribute deleteBuilder.addKeyRestrictionsLeniently( pluralAttribute.getIndexDescriptor() );
.getIndexDescriptor()
.forEachSelectable( deleteBuilder::addKeyRestrictionLeniently );
} }
else { else {
pluralAttribute deleteBuilder.addKeyRestrictions( pluralAttribute.getElementDescriptor() );
.getElementDescriptor()
.forEachSelectable( deleteBuilder::addKeyRestriction );
} }
} }

View File

@ -32,6 +32,7 @@ import org.hibernate.metamodel.mapping.EntityMappingType;
import org.hibernate.metamodel.mapping.ForeignKeyDescriptor; import org.hibernate.metamodel.mapping.ForeignKeyDescriptor;
import org.hibernate.metamodel.mapping.ModelPart.JdbcValueConsumer; import org.hibernate.metamodel.mapping.ModelPart.JdbcValueConsumer;
import org.hibernate.metamodel.mapping.PluralAttributeMapping; import org.hibernate.metamodel.mapping.PluralAttributeMapping;
import org.hibernate.metamodel.mapping.SelectableMapping;
import org.hibernate.metamodel.mapping.internal.EntityCollectionPart; import org.hibernate.metamodel.mapping.internal.EntityCollectionPart;
import org.hibernate.metamodel.mapping.internal.OneToManyCollectionPart; import org.hibernate.metamodel.mapping.internal.OneToManyCollectionPart;
import org.hibernate.metamodel.spi.RuntimeModelCreationContext; import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
@ -563,9 +564,12 @@ public class OneToManyPersister extends AbstractCollectionPersister {
// for each key column - // for each key column -
// 1) set the value to null // 1) set the value to null
// 2) restrict based on key value // 2) restrict based on key value
getAttributeMapping().getKeyDescriptor().forEachSelectable( (index, selectable) -> { final ForeignKeyDescriptor keyDescriptor = getAttributeMapping().getKeyDescriptor();
final int keyTypeCount = keyDescriptor.getJdbcTypeCount();
for ( int i = 0; i < keyTypeCount; i++ ) {
final SelectableMapping selectable = keyDescriptor.getSelectable( i );
if ( selectable.isFormula() ) { if ( selectable.isFormula() ) {
return; continue;
} }
if ( selectable.isUpdateable() ) { if ( selectable.isUpdateable() ) {
@ -579,15 +583,18 @@ public class OneToManyPersister extends AbstractCollectionPersister {
// restrict // restrict
updateBuilder.addKeyRestrictionLeniently( selectable ); updateBuilder.addKeyRestrictionLeniently( selectable );
} ); }
// set the value for each index column to null // set the value for each index column to null
if ( hasIndex && !indexContainsFormula ) { if ( hasIndex && !indexContainsFormula ) {
assert getAttributeMapping().getIndexDescriptor() != null; final CollectionPart indexDescriptor = getAttributeMapping().getIndexDescriptor();
assert indexDescriptor != null;
getAttributeMapping().getIndexDescriptor().forEachSelectable( (index, selectable) -> { final int indexTypeCount = indexDescriptor.getJdbcTypeCount();
for ( int i = 0; i < indexTypeCount; i++ ) {
final SelectableMapping selectable = indexDescriptor.getSelectable( i );
if ( !selectable.isUpdateable() ) { if ( !selectable.isUpdateable() ) {
return; continue;
} }
updateBuilder.addValueColumn( updateBuilder.addValueColumn(
@ -595,14 +602,14 @@ public class OneToManyPersister extends AbstractCollectionPersister {
NULL, NULL,
selectable.getJdbcMapping() selectable.getJdbcMapping()
); );
} ); }
} }
// for one-to-many, we know the element is an entity and need to restrict the update // for one-to-many, we know the element is an entity and need to restrict the update
// based on the element's id // based on the element's id
final EntityCollectionPart entityPart = (EntityCollectionPart) getAttributeMapping().getElementDescriptor(); final EntityCollectionPart entityPart = (EntityCollectionPart) getAttributeMapping().getElementDescriptor();
final EntityIdentifierMapping entityId = entityPart.getAssociatedEntityMappingType().getIdentifierMapping(); final EntityIdentifierMapping entityId = entityPart.getAssociatedEntityMappingType().getIdentifierMapping();
entityId.forEachSelectable( updateBuilder::addKeyRestrictionLeniently ); updateBuilder.addKeyRestrictionsLeniently( entityId );
//noinspection unchecked,rawtypes //noinspection unchecked,rawtypes
return (RestrictedTableMutation) updateBuilder.buildMutation(); return (RestrictedTableMutation) updateBuilder.buildMutation();
@ -640,11 +647,8 @@ public class OneToManyPersister extends AbstractCollectionPersister {
final EntityCollectionPart elementDescriptor = (EntityCollectionPart) attributeMapping.getElementDescriptor(); final EntityCollectionPart elementDescriptor = (EntityCollectionPart) attributeMapping.getElementDescriptor();
final EntityMappingType elementType = elementDescriptor.getAssociatedEntityMappingType(); final EntityMappingType elementType = elementDescriptor.getAssociatedEntityMappingType();
elementType.getIdentifierMapping().forEachSelectable( (position, mapping) -> { assert tableReference.getTableName().equals( elementType.getIdentifierMapping().getContainingTableExpression() );
assert tableReference.getTableName().equals( mapping.getContainingTableExpression() ); updateBuilder.addKeyRestrictionsLeniently( elementType.getIdentifierMapping() );
updateBuilder.addKeyRestrictionLeniently( mapping );
} );
return (TableUpdate<JdbcMutationOperation>) updateBuilder.buildMutation(); return (TableUpdate<JdbcMutationOperation>) updateBuilder.buildMutation();
} }
@ -728,16 +732,11 @@ public class OneToManyPersister extends AbstractCollectionPersister {
final TableUpdateBuilderStandard<JdbcMutationOperation> updateBuilder = new TableUpdateBuilderStandard<>( this, tableReference, getFactory() ); final TableUpdateBuilderStandard<JdbcMutationOperation> updateBuilder = new TableUpdateBuilderStandard<>( this, tableReference, getFactory() );
final OneToManyCollectionPart elementDescriptor = (OneToManyCollectionPart) getAttributeMapping().getElementDescriptor(); final OneToManyCollectionPart elementDescriptor = (OneToManyCollectionPart) getAttributeMapping().getElementDescriptor();
elementDescriptor updateBuilder.addKeyRestrictionsLeniently( elementDescriptor.getAssociatedEntityMappingType().getIdentifierMapping() );
.getAssociatedEntityMappingType()
.getIdentifierMapping()
.forEachSelectable( updateBuilder::addKeyRestrictionLeniently );
// if the collection has an identifier, add its column as well // if the collection has an identifier, add its column as well
if ( getAttributeMapping().getIdentifierDescriptor() != null ) { if ( getAttributeMapping().getIdentifierDescriptor() != null ) {
getAttributeMapping() updateBuilder.addKeyRestrictionsLeniently( getAttributeMapping().getIdentifierDescriptor() );
.getIdentifierDescriptor()
.forEachSelectable( updateBuilder::addKeyRestrictionLeniently );
} }
// for each index column: // for each index column:

View File

@ -19,6 +19,7 @@ import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.metamodel.mapping.AttributeMapping; import org.hibernate.metamodel.mapping.AttributeMapping;
import org.hibernate.metamodel.mapping.EntityRowIdMapping; import org.hibernate.metamodel.mapping.EntityRowIdMapping;
import org.hibernate.metamodel.mapping.SelectableMapping;
import org.hibernate.metamodel.mapping.SingularAttributeMapping; import org.hibernate.metamodel.mapping.SingularAttributeMapping;
import org.hibernate.persister.entity.AbstractEntityPersister; import org.hibernate.persister.entity.AbstractEntityPersister;
import org.hibernate.sql.model.MutationOperationGroup; import org.hibernate.sql.model.MutationOperationGroup;
@ -28,6 +29,7 @@ import org.hibernate.sql.model.ast.builder.RestrictedTableMutationBuilder;
import org.hibernate.sql.model.ast.builder.TableDeleteBuilder; import org.hibernate.sql.model.ast.builder.TableDeleteBuilder;
import org.hibernate.sql.model.ast.builder.TableDeleteBuilderSkipped; import org.hibernate.sql.model.ast.builder.TableDeleteBuilderSkipped;
import org.hibernate.sql.model.ast.builder.TableDeleteBuilderStandard; import org.hibernate.sql.model.ast.builder.TableDeleteBuilderStandard;
import org.hibernate.sql.model.ast.builder.TableMutationBuilder;
import static org.hibernate.engine.jdbc.mutation.internal.ModelMutationHelper.identifiedResultsCheck; import static org.hibernate.engine.jdbc.mutation.internal.ModelMutationHelper.identifiedResultsCheck;
@ -157,11 +159,15 @@ public class DeleteCoordinator extends AbstractMutationCoordinator {
SharedSessionContractImplementor session, SharedSessionContractImplementor session,
JdbcValueBindings jdbcValueBindings) { JdbcValueBindings jdbcValueBindings) {
if ( loadedState != null ) { if ( loadedState != null ) {
final boolean[] versionability = entityPersister().getPropertyVersionability(); final AbstractEntityPersister persister = entityPersister();
entityPersister().forEachAttributeMapping( (attributeIndex, attribute) -> { final boolean[] versionability = persister.getPropertyVersionability();
if ( versionability[attributeIndex] && attribute instanceof SingularAttributeMapping ) { for ( int attributeIndex = 0; attributeIndex < versionability.length; attributeIndex++ ) {
final AttributeMapping attribute;
// only makes sense to lock on singular attributes which are not excluded from optimistic locking
if ( versionability[attributeIndex] && ( attribute = persister.getAttributeMapping( attributeIndex ) ) instanceof SingularAttributeMapping ) {
final Object loadedValue = loadedState[attributeIndex]; final Object loadedValue = loadedState[attributeIndex];
if ( loadedValue != null ) { if ( loadedValue != null ) {
final String mutationTableName = persister.getAttributeMutationTableName( attributeIndex );
attribute.breakDownJdbcValues( attribute.breakDownJdbcValues(
loadedValue, loadedValue,
(jdbcValue, jdbcValueMapping) -> { (jdbcValue, jdbcValueMapping) -> {
@ -172,7 +178,7 @@ public class DeleteCoordinator extends AbstractMutationCoordinator {
jdbcValueBindings.bindValue( jdbcValueBindings.bindValue(
jdbcValue, jdbcValue,
entityPersister().getAttributeMutationTableName( attributeIndex ), mutationTableName,
jdbcValueMapping.getSelectionExpression(), jdbcValueMapping.getSelectionExpression(),
ParameterUsage.RESTRICT, ParameterUsage.RESTRICT,
session session
@ -182,7 +188,7 @@ public class DeleteCoordinator extends AbstractMutationCoordinator {
); );
} }
} }
} ); }
} }
} }
@ -347,31 +353,28 @@ public class DeleteCoordinator extends AbstractMutationCoordinator {
if ( applyVersion ) { if ( applyVersion ) {
// apply any optimistic locking // apply any optimistic locking
applyOptimisticLocking( deleteGroupBuilder, loadedState, session ); applyOptimisticLocking( deleteGroupBuilder, loadedState, session );
if ( entityPersister().hasPartitionedSelectionMapping() ) { final AbstractEntityPersister persister = entityPersister();
entityPersister().forEachSelectable( if ( persister.hasPartitionedSelectionMapping() ) {
(selectionIndex, selectableMapping) -> { for ( AttributeMapping attributeMapping : persister.getAttributeMappings() ) {
final int jdbcTypeCount = attributeMapping.getJdbcTypeCount();
for ( int i = 0; i < jdbcTypeCount; i++ ) {
final SelectableMapping selectableMapping = attributeMapping.getSelectable( i );
if ( selectableMapping.isPartitioned() ) { if ( selectableMapping.isPartitioned() ) {
final String tableNameForMutation = final String tableNameForMutation =
entityPersister().physicalTableNameForMutation( selectableMapping ); persister.physicalTableNameForMutation( selectableMapping );
final RestrictedTableMutationBuilder<?, ?> rootTableMutationBuilder = final RestrictedTableMutationBuilder<?, ?> rootTableMutationBuilder =
deleteGroupBuilder.findTableDetailsBuilder( tableNameForMutation ); deleteGroupBuilder.findTableDetailsBuilder( tableNameForMutation );
rootTableMutationBuilder.addKeyRestrictionLeniently( selectableMapping ); rootTableMutationBuilder.addKeyRestrictionLeniently( selectableMapping );
} }
} }
); }
} }
} }
// todo (6.2) : apply where + where-fragments // todo (6.2) : apply where + where-fragments
} }
private static void applyKeyDetails(TableDeleteBuilder tableDeleteBuilder, EntityTableMapping tableMapping) { private static void applyKeyDetails(TableDeleteBuilder tableDeleteBuilder, EntityTableMapping tableMapping) {
tableMapping.getKeyMapping().forEachKeyColumn( tableDeleteBuilder.addKeyRestrictions( tableMapping.getKeyMapping() );
(columnMapping) -> tableDeleteBuilder.addKeyRestriction(
columnMapping.getColumnName(),
columnMapping.getWriteExpression(),
columnMapping.getJdbcMapping()
)
);
} }
protected void applyOptimisticLocking( protected void applyOptimisticLocking(
@ -406,18 +409,20 @@ public class DeleteCoordinator extends AbstractMutationCoordinator {
MutationGroupBuilder mutationGroupBuilder, MutationGroupBuilder mutationGroupBuilder,
Object[] loadedState, Object[] loadedState,
SharedSessionContractImplementor session) { SharedSessionContractImplementor session) {
final AbstractEntityPersister persister = entityPersister();
assert loadedState != null; assert loadedState != null;
assert lockStyle.isAllOrDirty(); assert lockStyle.isAllOrDirty();
assert entityPersister().optimisticLockStyle().isAllOrDirty(); assert persister.optimisticLockStyle().isAllOrDirty();
assert session != null; assert session != null;
final boolean[] versionability = entityPersister().getPropertyVersionability(); final boolean[] versionability = persister.getPropertyVersionability();
entityPersister().forEachAttributeMapping( (attributeIndex, attribute) -> { for ( int attributeIndex = 0; attributeIndex < versionability.length; attributeIndex++ ) {
final AttributeMapping attribute;
// only makes sense to lock on singular attributes which are not excluded from optimistic locking // only makes sense to lock on singular attributes which are not excluded from optimistic locking
if ( versionability[attributeIndex] && attribute instanceof SingularAttributeMapping ) { if ( versionability[attributeIndex] && ( attribute = persister.getAttributeMapping( attributeIndex ) ) instanceof SingularAttributeMapping ) {
breakDownJdbcValues( mutationGroupBuilder, session, attribute, loadedState[attributeIndex] ); breakDownJdbcValues( mutationGroupBuilder, session, attribute, loadedState[attributeIndex] );
} }
} ); }
} }
private void breakDownJdbcValues( private void breakDownJdbcValues(
@ -425,24 +430,16 @@ public class DeleteCoordinator extends AbstractMutationCoordinator {
SharedSessionContractImplementor session, SharedSessionContractImplementor session,
AttributeMapping attribute, AttributeMapping attribute,
Object loadedValue) { Object loadedValue) {
final RestrictedTableMutationBuilder<?, ?> tableMutationBuilder =
mutationGroupBuilder.findTableDetailsBuilder( attribute.getContainingTableExpression() );
if ( tableMutationBuilder != null && tableMutationBuilder.getOptimisticLockBindings() != null ) {
attribute.breakDownJdbcValues( attribute.breakDownJdbcValues(
loadedValue, loadedValue,
(jdbcValue, columnMapping) -> { tableMutationBuilder.getOptimisticLockBindings(),
final String physicalTableName = entityPersister().physicalTableNameForMutation( columnMapping );
final RestrictedTableMutationBuilder<?, ?> tableMutationBuilder =
mutationGroupBuilder.findTableDetailsBuilder( physicalTableName );
if ( tableMutationBuilder != null ) {
if (jdbcValue == null) {
tableMutationBuilder.addNullOptimisticLockRestriction( columnMapping );
}
else {
tableMutationBuilder.addOptimisticLockRestriction( columnMapping );
}
}
// else there is no actual delete statement for that table,
// generally indicates we have an on-delete=cascade situation
},
session session
); );
} }
// else there is no actual delete statement for that table,
// generally indicates we have an on-delete=cascade situation
}
} }

View File

@ -16,7 +16,9 @@ import org.hibernate.internal.util.collections.ArrayHelper;
import org.hibernate.jdbc.Expectation; import org.hibernate.jdbc.Expectation;
import org.hibernate.metamodel.mapping.JdbcMapping; import org.hibernate.metamodel.mapping.JdbcMapping;
import org.hibernate.metamodel.mapping.ModelPart; import org.hibernate.metamodel.mapping.ModelPart;
import org.hibernate.metamodel.mapping.SelectableConsumer;
import org.hibernate.metamodel.mapping.SelectableMapping; import org.hibernate.metamodel.mapping.SelectableMapping;
import org.hibernate.metamodel.mapping.SelectableMappings;
import org.hibernate.metamodel.mapping.TableDetails; import org.hibernate.metamodel.mapping.TableDetails;
import org.hibernate.sql.model.MutationType; import org.hibernate.sql.model.MutationType;
import org.hibernate.sql.model.TableMapping; import org.hibernate.sql.model.TableMapping;
@ -209,7 +211,7 @@ public class EntityTableMapping implements TableMapping {
void consume(Object jdbcValue, KeyColumn columnMapping); void consume(Object jdbcValue, KeyColumn columnMapping);
} }
public static class KeyMapping implements KeyDetails { public static class KeyMapping implements KeyDetails, SelectableMappings {
private final List<KeyColumn> keyColumns; private final List<KeyColumn> keyColumns;
private final ModelPart identifierPart; private final ModelPart identifierPart;
@ -260,6 +262,25 @@ public class EntityTableMapping implements TableMapping {
public void forEachKeyColumn(Consumer<KeyColumn> keyColumnConsumer) { public void forEachKeyColumn(Consumer<KeyColumn> keyColumnConsumer) {
keyColumns.forEach( keyColumnConsumer ); keyColumns.forEach( keyColumnConsumer );
} }
@Override
public int getJdbcTypeCount() {
return keyColumns.size();
}
@Override
public SelectableMapping getSelectable(int columnIndex) {
return keyColumns.get( columnIndex );
}
@Override
public int forEachSelectable(int offset, SelectableConsumer consumer) {
for ( int i = 0; i < keyColumns.size(); i++ ) {
consumer.accept( i, keyColumns.get( i ) );
}
return getJdbcTypeCount();
}
} }
public static class KeyColumn implements SelectableMapping, TableDetails.KeyColumn { public static class KeyColumn implements SelectableMapping, TableDetails.KeyColumn {

View File

@ -631,9 +631,10 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
SharedSessionContractImplementor session) { SharedSessionContractImplementor session) {
if ( inclusionChecker.include( attributeIndex, attributeMapping ) ) { if ( inclusionChecker.include( attributeIndex, attributeMapping ) ) {
attributeMapping.forEachSelectable( (selectableIndex, selectable) -> { final int jdbcTypeCount = attributeMapping.getJdbcTypeCount();
processSet( analysis, selectable ); for ( int i = 0; i < jdbcTypeCount; i++ ) {
} ); processSet( analysis, attributeMapping.getSelectable( i ) );
}
} }
if ( lockingChecker.include( attributeIndex, attributeMapping ) ) { if ( lockingChecker.include( attributeIndex, attributeMapping ) ) {
@ -1064,14 +1065,17 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
} }
private void applyPartictionKeyRestriction(TableUpdateBuilder<?> tableUpdateBuilder) { private void applyPartictionKeyRestriction(TableUpdateBuilder<?> tableUpdateBuilder) {
if ( entityPersister().hasPartitionedSelectionMapping() ) { final AbstractEntityPersister persister = entityPersister();
entityPersister().forEachSelectable( if ( persister.hasPartitionedSelectionMapping() ) {
(selectionIndex, selectableMapping) -> { for ( AttributeMapping attributeMapping : persister.getAttributeMappings() ) {
final int jdbcTypeCount = attributeMapping.getJdbcTypeCount();
for ( int i = 0; i < jdbcTypeCount; i++ ) {
final SelectableMapping selectableMapping = attributeMapping.getSelectable( i );
if ( selectableMapping.isPartitioned() ) { if ( selectableMapping.isPartitioned() ) {
tableUpdateBuilder.addKeyRestrictionLeniently( selectableMapping ); tableUpdateBuilder.addKeyRestrictionLeniently( selectableMapping );
} }
} }
); }
} }
} }
@ -1084,13 +1088,7 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
tableUpdateBuilder.addKeyRestrictionLeniently( rowIdMapping ); tableUpdateBuilder.addKeyRestrictionLeniently( rowIdMapping );
} }
else { else {
tableMapping.getKeyMapping().forEachKeyColumn( tableUpdateBuilder.addKeyRestrictions( tableMapping.getKeyMapping() );
keyColumn -> tableUpdateBuilder.addKeyRestriction(
keyColumn.getColumnName(),
"?",
keyColumn.getJdbcMapping()
)
);
} }
} }
@ -1101,21 +1099,12 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
AttributeMapping attributeMapping, AttributeMapping attributeMapping,
TableUpdateBuilder<?> tableUpdateBuilder) { TableUpdateBuilder<?> tableUpdateBuilder) {
if ( oldValues == null ) { if ( oldValues == null ) {
attributeMapping.forEachSelectable( tableUpdateBuilder.addOptimisticLockRestrictions( attributeMapping );
(index, selectableMapping) -> tableUpdateBuilder.addOptimisticLockRestriction( selectableMapping )
);
} }
else { else if ( tableUpdateBuilder.getOptimisticLockBindings() != null ) {
attributeMapping.decompose( attributeMapping.decompose(
oldValues[attributeIndex], oldValues[attributeIndex],
(jdbcValue, jdbcMapping) -> { tableUpdateBuilder.getOptimisticLockBindings(),
if ( jdbcValue == null ) {
tableUpdateBuilder.addNullOptimisticLockRestriction( jdbcMapping );
}
else {
tableUpdateBuilder.addOptimisticLockRestriction( jdbcMapping );
}
},
session session
); );
} }
@ -1562,9 +1551,7 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
updateBuilder.addValueColumn( versionMapping ); updateBuilder.addValueColumn( versionMapping );
entityPersister().getIdentifierMapping().forEachSelectable( updateBuilder.addKeyRestrictionsLeniently( entityPersister().getIdentifierMapping() );
(selectionIndex, selectableMapping) -> updateBuilder.addKeyRestrictionLeniently( selectableMapping )
);
updateBuilder.addOptimisticLockRestriction( versionMapping ); updateBuilder.addOptimisticLockRestriction( versionMapping );
addPartitionRestriction( updateBuilder ); addPartitionRestriction( updateBuilder );
@ -1583,14 +1570,17 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
} }
private void addPartitionRestriction(TableUpdateBuilderStandard<JdbcMutationOperation> updateBuilder) { private void addPartitionRestriction(TableUpdateBuilderStandard<JdbcMutationOperation> updateBuilder) {
if ( entityPersister().hasPartitionedSelectionMapping() ) { final AbstractEntityPersister persister = entityPersister();
entityPersister().forEachSelectable( if ( persister.hasPartitionedSelectionMapping() ) {
(selectionIndex, selectableMapping) -> { for ( AttributeMapping attributeMapping : persister.getAttributeMappings() ) {
final int jdbcTypeCount = attributeMapping.getJdbcTypeCount();
for ( int i = 0; i < jdbcTypeCount; i++ ) {
final SelectableMapping selectableMapping = attributeMapping.getSelectable( i );
if ( selectableMapping.isPartitioned() ) { if ( selectableMapping.isPartitioned() ) {
updateBuilder.addKeyRestrictionLeniently( selectableMapping ); updateBuilder.addKeyRestrictionLeniently( selectableMapping );
} }
} }
); }
} }
} }

View File

@ -0,0 +1,115 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html.
*/
package org.hibernate.sql.model.ast;
import java.util.ArrayList;
import org.hibernate.Internal;
import org.hibernate.engine.jdbc.mutation.ParameterUsage;
import org.hibernate.metamodel.mapping.EmbeddableMappingType;
import org.hibernate.metamodel.mapping.JdbcMapping;
import org.hibernate.metamodel.mapping.ModelPart;
import org.hibernate.metamodel.mapping.SelectableMapping;
import org.hibernate.sql.ast.tree.expression.ColumnReference;
import org.hibernate.type.descriptor.jdbc.AggregateJdbcType;
import org.hibernate.type.descriptor.jdbc.JdbcType;
@Internal
public class ColumnValueBindingList extends ArrayList<ColumnValueBinding> implements ModelPart.JdbcValueConsumer {
private final MutatingTableReference mutatingTable;
private final ColumnValueParameterList parameters;
private final ParameterUsage parameterUsage;
public ColumnValueBindingList(
MutatingTableReference mutatingTable,
ColumnValueParameterList parameters,
ParameterUsage parameterUsage) {
this.mutatingTable = mutatingTable;
this.parameters = parameters;
this.parameterUsage = parameterUsage;
}
@Override
public Object clone() {
throw new UnsupportedOperationException();
}
@Override
public void consume(Object value, SelectableMapping jdbcValueMapping) {
final ColumnValueBinding columnValueBinding = createValueBinding(
jdbcValueMapping.getSelectionExpression(),
value == null ? null : jdbcValueMapping.getWriteExpression(),
jdbcValueMapping.getJdbcMapping()
);
add( columnValueBinding );
}
public void addNullRestriction(SelectableMapping column) {
add( createValueBinding( column.getSelectionExpression(), null, column.getJdbcMapping() ) );
}
public void addRestriction(SelectableMapping column) {
add(
createValueBinding(
column.getSelectionExpression(),
column.getWriteExpression(),
column.getJdbcMapping()
)
);
}
public void addRestriction(String columnName, String columnWriteFragment, JdbcMapping jdbcMapping) {
add( createValueBinding( columnName, columnWriteFragment, jdbcMapping ) );
}
protected ColumnValueBinding createValueBinding(
String columnName,
String customWriteExpression,
JdbcMapping jdbcMapping) {
final ColumnReference columnReference = new ColumnReference( mutatingTable, columnName, jdbcMapping );
final ColumnWriteFragment columnWriteFragment;
if ( customWriteExpression == null ) {
columnWriteFragment = null;
}
else if ( customWriteExpression.contains( "?" ) ) {
final JdbcType jdbcType = jdbcMapping.getJdbcType();
final EmbeddableMappingType aggregateMappingType = jdbcType instanceof AggregateJdbcType
? ( (AggregateJdbcType) jdbcType ).getEmbeddableMappingType()
: null;
if ( aggregateMappingType != null && !aggregateMappingType.shouldBindAggregateMapping() ) {
final ColumnValueParameterList parameters = new ColumnValueParameterList(
mutatingTable,
parameterUsage,
aggregateMappingType.getJdbcTypeCount()
);
aggregateMappingType.forEachSelectable( parameters );
this.parameters.addAll( parameters );
columnWriteFragment = new ColumnWriteFragment(
customWriteExpression,
parameters,
jdbcMapping
);
}
else {
final ColumnValueParameter parameter = new ColumnValueParameter( columnReference, parameterUsage );
parameters.add( parameter );
columnWriteFragment = new ColumnWriteFragment( customWriteExpression, parameter, jdbcMapping );
}
}
else {
columnWriteFragment = new ColumnWriteFragment( customWriteExpression, jdbcMapping );
}
return new ColumnValueBinding( columnReference, columnWriteFragment ) ;
}
@Override
public String toString() {
return "ColumnValueBindingList" + super.toString();
}
}

View File

@ -30,6 +30,11 @@ public class ColumnValueParameterList extends ArrayList<ColumnValueParameter> im
this.parameterUsage = parameterUsage; this.parameterUsage = parameterUsage;
} }
@Override
public Object clone() {
throw new UnsupportedOperationException();
}
@Override @Override
public void accept(int selectionIndex, SelectableMapping selectableMapping) { public void accept(int selectionIndex, SelectableMapping selectableMapping) {
add( add(

View File

@ -6,19 +6,15 @@
*/ */
package org.hibernate.sql.model.ast.builder; package org.hibernate.sql.model.ast.builder;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.engine.jdbc.mutation.ParameterUsage; import org.hibernate.engine.jdbc.mutation.ParameterUsage;
import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.metamodel.mapping.JdbcMapping; import org.hibernate.metamodel.mapping.JdbcMapping;
import org.hibernate.metamodel.mapping.SelectableMapping; import org.hibernate.metamodel.mapping.SelectableMapping;
import org.hibernate.sql.ast.tree.expression.ColumnReference;
import org.hibernate.sql.model.MutationOperation; import org.hibernate.sql.model.MutationOperation;
import org.hibernate.sql.model.MutationTarget; import org.hibernate.sql.model.MutationTarget;
import org.hibernate.sql.model.MutationType; import org.hibernate.sql.model.MutationType;
import org.hibernate.sql.model.TableMapping; import org.hibernate.sql.model.TableMapping;
import org.hibernate.sql.model.ast.ColumnValueBinding; import org.hibernate.sql.model.ast.ColumnValueBindingList;
import org.hibernate.sql.model.ast.MutatingTableReference; import org.hibernate.sql.model.ast.MutatingTableReference;
import org.hibernate.sql.model.ast.RestrictedTableMutation; import org.hibernate.sql.model.ast.RestrictedTableMutation;
@ -32,8 +28,8 @@ public abstract class AbstractRestrictedTableMutationBuilder<O extends MutationO
extends AbstractTableMutationBuilder<M> extends AbstractTableMutationBuilder<M>
implements RestrictedTableMutationBuilder<O, M> { implements RestrictedTableMutationBuilder<O, M> {
private final List<ColumnValueBinding> keyRestrictionBindings = new ArrayList<>(); private final ColumnValueBindingList keyRestrictionBindings;
private List<ColumnValueBinding> optimisticLockBindings; private final ColumnValueBindingList optimisticLockBindings;
public AbstractRestrictedTableMutationBuilder( public AbstractRestrictedTableMutationBuilder(
MutationType mutationType, MutationType mutationType,
@ -41,6 +37,8 @@ public abstract class AbstractRestrictedTableMutationBuilder<O extends MutationO
TableMapping table, TableMapping table,
SessionFactoryImplementor sessionFactory) { SessionFactoryImplementor sessionFactory) {
super( mutationType, mutationTarget, table, sessionFactory ); super( mutationType, mutationTarget, table, sessionFactory );
this.keyRestrictionBindings = new ColumnValueBindingList( getMutatingTable(), getParameters(), ParameterUsage.RESTRICT );
this.optimisticLockBindings = new ColumnValueBindingList( getMutatingTable(), getParameters(), ParameterUsage.RESTRICT );
} }
public AbstractRestrictedTableMutationBuilder( public AbstractRestrictedTableMutationBuilder(
@ -49,47 +47,33 @@ public abstract class AbstractRestrictedTableMutationBuilder<O extends MutationO
MutatingTableReference tableReference, MutatingTableReference tableReference,
SessionFactoryImplementor sessionFactory) { SessionFactoryImplementor sessionFactory) {
super( mutationType, mutationTarget, tableReference, sessionFactory ); super( mutationType, mutationTarget, tableReference, sessionFactory );
this.keyRestrictionBindings = new ColumnValueBindingList( getMutatingTable(), getParameters(), ParameterUsage.RESTRICT );
this.optimisticLockBindings = new ColumnValueBindingList( getMutatingTable(), getParameters(), ParameterUsage.RESTRICT );
} }
public List<ColumnValueBinding> getKeyRestrictionBindings() { @Override
public ColumnValueBindingList getKeyRestrictionBindings() {
return keyRestrictionBindings; return keyRestrictionBindings;
} }
public List<ColumnValueBinding> getOptimisticLockBindings() { @Override
public ColumnValueBindingList getOptimisticLockBindings() {
return optimisticLockBindings; return optimisticLockBindings;
} }
@Override @Override
public void addKeyRestriction(String columnName, String columnWriteFragment, JdbcMapping jdbcMapping) { public void addKeyRestriction(String columnName, String columnWriteFragment, JdbcMapping jdbcMapping) {
addColumn( keyRestrictionBindings.addRestriction( columnName, columnWriteFragment, jdbcMapping );
columnName,
columnWriteFragment,
jdbcMapping,
ParameterUsage.RESTRICT,
keyRestrictionBindings
);
} }
@Override @Override
public void addNullOptimisticLockRestriction(SelectableMapping column) { public void addNullOptimisticLockRestriction(SelectableMapping column) {
if ( optimisticLockBindings == null ) { optimisticLockBindings.addNullRestriction( column );
optimisticLockBindings = new ArrayList<>();
}
final ColumnReference columnReference = new ColumnReference(
getMutatingTable(),
column.getSelectionExpression(),
column.getJdbcMapping()
);
optimisticLockBindings.add( new ColumnValueBinding( columnReference, null ) );
} }
@Override @Override
public void addOptimisticLockRestriction(String columnName, String columnWriteFragment, JdbcMapping jdbcMapping) { public void addOptimisticLockRestriction(String columnName, String columnWriteFragment, JdbcMapping jdbcMapping) {
if ( optimisticLockBindings == null ) { optimisticLockBindings.addRestriction( columnName, columnWriteFragment, jdbcMapping );
optimisticLockBindings = new ArrayList<>();
}
addColumn( columnName, columnWriteFragment, jdbcMapping, ParameterUsage.RESTRICT, optimisticLockBindings );
} }
@Override @Override

View File

@ -31,8 +31,6 @@ public abstract class AbstractTableInsertBuilder
private final List<ColumnValueBinding> valueBindingList = new ArrayList<>(); private final List<ColumnValueBinding> valueBindingList = new ArrayList<>();
private List<ColumnValueBinding> lobValueBindingList; private List<ColumnValueBinding> lobValueBindingList;
private final List<ColumnValueParameter> parameters = new ArrayList<>();
private String sqlComment; private String sqlComment;
public AbstractTableInsertBuilder( public AbstractTableInsertBuilder(
@ -71,10 +69,6 @@ public abstract class AbstractTableInsertBuilder
return lobValueBindingList; return lobValueBindingList;
} }
protected List<ColumnValueParameter> getParameters() {
return parameters;
}
@Override @Override
public void addValueColumn(String columnName, String columnWriteFragment, JdbcMapping jdbcMapping) { public void addValueColumn(String columnName, String columnWriteFragment, JdbcMapping jdbcMapping) {
final ColumnValueBinding valueBinding = createValueBinding( columnName, columnWriteFragment, jdbcMapping ); final ColumnValueBinding valueBinding = createValueBinding( columnName, columnWriteFragment, jdbcMapping );
@ -94,9 +88,4 @@ public abstract class AbstractTableInsertBuilder
public void addKeyColumn(String columnName, String columnWriteFragment, JdbcMapping jdbcMapping) { public void addKeyColumn(String columnName, String columnWriteFragment, JdbcMapping jdbcMapping) {
addColumn( columnName, columnWriteFragment, jdbcMapping, keyBindingList ); addColumn( columnName, columnWriteFragment, jdbcMapping, keyBindingList );
} }
@Override
protected void handleParameterCreation(ColumnValueParameter parameter) {
parameters.add( parameter );
}
} }

View File

@ -39,6 +39,7 @@ public abstract class AbstractTableMutationBuilder<M extends TableMutation<?>> i
private final MutationTarget<?> mutationTarget; private final MutationTarget<?> mutationTarget;
private final MutatingTableReference mutatingTable; private final MutatingTableReference mutatingTable;
private final ColumnValueParameterList parameters;
public AbstractTableMutationBuilder( public AbstractTableMutationBuilder(
MutationType mutationType, MutationType mutationType,
@ -58,6 +59,7 @@ public abstract class AbstractTableMutationBuilder<M extends TableMutation<?>> i
this.sessionFactory = sessionFactory; this.sessionFactory = sessionFactory;
this.mutatingTable = mutatingTable; this.mutatingTable = mutatingTable;
this.parameters = new ColumnValueParameterList( mutatingTable, null, 0 );
} }
protected MutationTarget<?> getMutationTarget() { protected MutationTarget<?> getMutationTarget() {
@ -69,6 +71,10 @@ public abstract class AbstractTableMutationBuilder<M extends TableMutation<?>> i
return mutatingTable; return mutatingTable;
} }
protected ColumnValueParameterList getParameters() {
return parameters;
}
protected SessionFactoryImplementor getSessionFactory() { protected SessionFactoryImplementor getSessionFactory() {
return sessionFactory; return sessionFactory;
} }
@ -122,9 +128,7 @@ public abstract class AbstractTableMutationBuilder<M extends TableMutation<?>> i
aggregateMappingType.getJdbcTypeCount() aggregateMappingType.getJdbcTypeCount()
); );
aggregateMappingType.forEachSelectable( parameters ); aggregateMappingType.forEachSelectable( parameters );
for ( int i = 0; i < parameters.size(); i++ ) { this.parameters.addAll( parameters );
handleParameterCreation( parameters.get( i ) );
}
columnWriteFragment = new ColumnWriteFragment( columnWriteFragment = new ColumnWriteFragment(
customWriteExpression, customWriteExpression,
@ -134,7 +138,7 @@ public abstract class AbstractTableMutationBuilder<M extends TableMutation<?>> i
} }
else { else {
final ColumnValueParameter parameter = new ColumnValueParameter( columnReference, parameterUsage ); final ColumnValueParameter parameter = new ColumnValueParameter( columnReference, parameterUsage );
handleParameterCreation( parameter ); parameters.add( parameter );
columnWriteFragment = new ColumnWriteFragment( customWriteExpression, parameter, jdbcMapping ); columnWriteFragment = new ColumnWriteFragment( customWriteExpression, parameter, jdbcMapping );
} }
} }
@ -144,8 +148,6 @@ public abstract class AbstractTableMutationBuilder<M extends TableMutation<?>> i
return new ColumnValueBinding( columnReference, columnWriteFragment ) ; return new ColumnValueBinding( columnReference, columnWriteFragment ) ;
} }
protected abstract void handleParameterCreation(ColumnValueParameter parameter);
@SafeVarargs @SafeVarargs
protected final <T> List<T> combine(List<T> list1, List<T>... additionalLists) { protected final <T> List<T> combine(List<T> list1, List<T>... additionalLists) {
final ArrayList<T> combined = list1 == null final ArrayList<T> combined = list1 == null

View File

@ -9,7 +9,9 @@ package org.hibernate.sql.model.ast.builder;
import org.hibernate.metamodel.mapping.JdbcMapping; import org.hibernate.metamodel.mapping.JdbcMapping;
import org.hibernate.metamodel.mapping.SelectableConsumer; import org.hibernate.metamodel.mapping.SelectableConsumer;
import org.hibernate.metamodel.mapping.SelectableMapping; import org.hibernate.metamodel.mapping.SelectableMapping;
import org.hibernate.metamodel.mapping.SelectableMappings;
import org.hibernate.sql.model.MutationOperation; import org.hibernate.sql.model.MutationOperation;
import org.hibernate.sql.model.ast.ColumnValueBindingList;
import org.hibernate.sql.model.ast.RestrictedTableMutation; import org.hibernate.sql.model.ast.RestrictedTableMutation;
/** /**
@ -22,6 +24,36 @@ import org.hibernate.sql.model.ast.RestrictedTableMutation;
*/ */
public interface RestrictedTableMutationBuilder<O extends MutationOperation, M extends RestrictedTableMutation<O>> extends TableMutationBuilder<M> { public interface RestrictedTableMutationBuilder<O extends MutationOperation, M extends RestrictedTableMutation<O>> extends TableMutationBuilder<M> {
/**
* Add a restriction as long as the selectable is not a formula and is not nullable
*/
default void addKeyRestrictions(SelectableMappings selectableMappings) {
final int jdbcTypeCount = selectableMappings.getJdbcTypeCount();
for ( int i = 0; i < jdbcTypeCount; i++ ) {
addKeyRestriction( selectableMappings.getSelectable( i ) );
}
}
/**
* Add a restriction as long as the selectable is not a formula and is not nullable
*/
default void addKeyRestrictionsLeniently(SelectableMappings selectableMappings) {
final int jdbcTypeCount = selectableMappings.getJdbcTypeCount();
for ( int i = 0; i < jdbcTypeCount; i++ ) {
addKeyRestrictionLeniently( selectableMappings.getSelectable( i ) );
}
}
/**
* Add restriction based on non-version optimistically-locked column
*/
default void addOptimisticLockRestrictions(SelectableMappings selectableMappings) {
final int jdbcTypeCount = selectableMappings.getJdbcTypeCount();
for ( int i = 0; i < jdbcTypeCount; i++ ) {
addOptimisticLockRestriction( selectableMappings.getSelectable( i ) );
}
}
/** /**
* Add a restriction as long as the selectable is not a formula and is not nullable * Add a restriction as long as the selectable is not a formula and is not nullable
*/ */
@ -32,29 +64,6 @@ public interface RestrictedTableMutationBuilder<O extends MutationOperation, M e
addKeyRestrictionLeniently( selectableMapping ); addKeyRestrictionLeniently( selectableMapping );
} }
/**
* Convenience form of {@link #addKeyRestriction(SelectableMapping)} matching the
* signature of {@link SelectableConsumer} allowing it to be used as a method reference
* in its place.
*
* @param dummy Ignored; here simply to satisfy the {@link SelectableConsumer} signature
*/
default void addKeyRestriction(@SuppressWarnings("unused") int dummy,SelectableMapping selectableMapping){
addKeyRestriction( selectableMapping );
}
/**
* Convenience form of {@link #addKeyRestrictionLeniently(SelectableMapping)} matching the
* signature of {@link SelectableConsumer} allowing it to be used as a method reference
* in its place.
*
* @param dummy Ignored; here simply to satisfy the {@link SelectableConsumer} signature
*/
default void addKeyRestrictionLeniently(@SuppressWarnings("unused") int dummy, SelectableMapping selectableMapping) {
addKeyRestrictionLeniently( selectableMapping );
}
/** /**
* Add a restriction as long as the selectable is not a formula * Add a restriction as long as the selectable is not a formula
*/ */
@ -92,6 +101,10 @@ public interface RestrictedTableMutationBuilder<O extends MutationOperation, M e
*/ */
void addOptimisticLockRestriction(String columnName, String columnWriteFragment, JdbcMapping jdbcMapping); void addOptimisticLockRestriction(String columnName, String columnWriteFragment, JdbcMapping jdbcMapping);
ColumnValueBindingList getKeyRestrictionBindings();
ColumnValueBindingList getOptimisticLockBindings();
void setWhere(String fragment); void setWhere(String fragment);
void addWhereFragment(String fragment); void addWhereFragment(String fragment);

View File

@ -9,6 +9,7 @@ package org.hibernate.sql.model.ast.builder;
import org.hibernate.metamodel.mapping.JdbcMapping; import org.hibernate.metamodel.mapping.JdbcMapping;
import org.hibernate.metamodel.mapping.SelectableMapping; import org.hibernate.metamodel.mapping.SelectableMapping;
import org.hibernate.sql.model.TableMapping; import org.hibernate.sql.model.TableMapping;
import org.hibernate.sql.model.ast.ColumnValueBindingList;
import org.hibernate.sql.model.ast.MutatingTableReference; import org.hibernate.sql.model.ast.MutatingTableReference;
import org.hibernate.sql.model.ast.TableDelete; import org.hibernate.sql.model.ast.TableDelete;
@ -34,6 +35,16 @@ public class TableDeleteBuilderSkipped implements TableDeleteBuilder {
public void addOptimisticLockRestriction(String columnName, String columnWriteFragment, JdbcMapping jdbcMapping) { public void addOptimisticLockRestriction(String columnName, String columnWriteFragment, JdbcMapping jdbcMapping) {
} }
@Override
public ColumnValueBindingList getKeyRestrictionBindings() {
return null;
}
@Override
public ColumnValueBindingList getOptimisticLockBindings() {
return null;
}
@Override @Override
public void setWhere(String fragment) { public void setWhere(String fragment) {
} }

View File

@ -32,8 +32,6 @@ public class TableDeleteBuilderStandard
implements TableDeleteBuilder { implements TableDeleteBuilder {
private final boolean isCustomSql; private final boolean isCustomSql;
private final List<ColumnValueParameter> parameters = new ArrayList<>();
private String sqlComment; private String sqlComment;
public TableDeleteBuilderStandard( public TableDeleteBuilderStandard(
@ -103,13 +101,4 @@ public class TableDeleteBuilderStandard
getParameters() getParameters()
); );
} }
protected List<ColumnValueParameter> getParameters() {
return parameters;
}
@Override
protected void handleParameterCreation(ColumnValueParameter parameter) {
parameters.add( parameter );
}
} }

View File

@ -8,6 +8,7 @@ package org.hibernate.sql.model.ast.builder;
import org.hibernate.metamodel.mapping.JdbcMapping; import org.hibernate.metamodel.mapping.JdbcMapping;
import org.hibernate.metamodel.mapping.SelectableMapping; import org.hibernate.metamodel.mapping.SelectableMapping;
import org.hibernate.sql.model.ast.ColumnValueBindingList;
import org.hibernate.sql.model.ast.MutatingTableReference; import org.hibernate.sql.model.ast.MutatingTableReference;
import org.hibernate.sql.model.ast.RestrictedTableMutation; import org.hibernate.sql.model.ast.RestrictedTableMutation;
import org.hibernate.sql.model.jdbc.JdbcMutationOperation; import org.hibernate.sql.model.jdbc.JdbcMutationOperation;
@ -47,6 +48,16 @@ public class TableUpdateBuilderSkipped implements TableUpdateBuilder {
// nothing to do // nothing to do
} }
@Override
public ColumnValueBindingList getKeyRestrictionBindings() {
return null;
}
@Override
public ColumnValueBindingList getOptimisticLockBindings() {
return null;
}
@Override @Override
public void addWhereFragment(String fragment) { public void addWhereFragment(String fragment) {
// nothing to do // nothing to do

View File

@ -80,10 +80,4 @@ public class TableUpdateBuilderStandard<O extends MutationOperation> extends Abs
getOptimisticLockBindings() getOptimisticLockBindings()
); );
} }
@Override
protected void handleParameterCreation(ColumnValueParameter parameter) {
// nothing to do for updates... each TableUpdate impl collects
// the parameters from the bindings in a specific order
}
} }