Get rid of some capturing lambdas
This commit is contained in:
parent
420e561f21
commit
e841b0aaae
|
@ -143,7 +143,7 @@ public class ManyToManyCollectionPart extends AbstractEntityCollectionPart imple
|
|||
|
||||
@Override
|
||||
public SelectableMapping getSelectable(int columnIndex) {
|
||||
return fkTargetModelPart.getSelectable( columnIndex );
|
||||
return foreignKey.getKeyPart().getSelectable( columnIndex );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -454,21 +454,16 @@ public class BasicCollectionPersister extends AbstractCollectionPersister {
|
|||
// WHERE
|
||||
|
||||
if ( attribute.getIdentifierDescriptor() != null ) {
|
||||
attribute.getIdentifierDescriptor().forEachSelectable( updateBuilder::addKeyRestrictionLeniently );
|
||||
updateBuilder.addKeyRestrictionsLeniently( attribute.getIdentifierDescriptor() );
|
||||
}
|
||||
else {
|
||||
attribute.getKeyDescriptor().getKeyPart().forEachSelectable( updateBuilder::addKeyRestrictionLeniently );
|
||||
updateBuilder.addKeyRestrictionsLeniently( attribute.getKeyDescriptor().getKeyPart() );
|
||||
|
||||
if ( attribute.getIndexDescriptor() != null && !indexContainsFormula ) {
|
||||
attribute.getIndexDescriptor().forEachSelectable( updateBuilder::addKeyRestrictionLeniently );
|
||||
updateBuilder.addKeyRestrictionsLeniently( attribute.getIndexDescriptor() );
|
||||
}
|
||||
else {
|
||||
attribute.getElementDescriptor().forEachSelectable( (selectionIndex, selectableMapping) -> {
|
||||
if ( selectableMapping.isFormula() ) {
|
||||
return;
|
||||
}
|
||||
updateBuilder.addKeyRestriction( selectableMapping );
|
||||
} );
|
||||
updateBuilder.addKeyRestrictions( attribute.getElementDescriptor() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -597,24 +592,17 @@ public class BasicCollectionPersister extends AbstractCollectionPersister {
|
|||
final TableDeleteBuilderStandard deleteBuilder = new TableDeleteBuilderStandard( this, tableReference, getFactory() );
|
||||
|
||||
if ( pluralAttribute.getIdentifierDescriptor() != null ) {
|
||||
deleteBuilder.addKeyRestrictionLeniently( pluralAttribute.getIdentifierDescriptor() );
|
||||
deleteBuilder.addKeyRestrictionsLeniently( pluralAttribute.getIdentifierDescriptor() );
|
||||
}
|
||||
else {
|
||||
pluralAttribute
|
||||
.getKeyDescriptor()
|
||||
.getKeyPart()
|
||||
.forEachSelectable( deleteBuilder::addKeyRestrictionLeniently );
|
||||
deleteBuilder.addKeyRestrictionsLeniently( pluralAttribute.getKeyDescriptor().getKeyPart() );
|
||||
|
||||
if ( hasIndex && !indexContainsFormula ) {
|
||||
assert pluralAttribute.getIndexDescriptor() != null;
|
||||
pluralAttribute
|
||||
.getIndexDescriptor()
|
||||
.forEachSelectable( deleteBuilder::addKeyRestrictionLeniently );
|
||||
deleteBuilder.addKeyRestrictionsLeniently( pluralAttribute.getIndexDescriptor() );
|
||||
}
|
||||
else {
|
||||
pluralAttribute
|
||||
.getElementDescriptor()
|
||||
.forEachSelectable( deleteBuilder::addKeyRestriction );
|
||||
deleteBuilder.addKeyRestrictions( pluralAttribute.getElementDescriptor() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.hibernate.metamodel.mapping.EntityMappingType;
|
|||
import org.hibernate.metamodel.mapping.ForeignKeyDescriptor;
|
||||
import org.hibernate.metamodel.mapping.ModelPart.JdbcValueConsumer;
|
||||
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.OneToManyCollectionPart;
|
||||
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
|
||||
|
@ -563,9 +564,12 @@ public class OneToManyPersister extends AbstractCollectionPersister {
|
|||
// for each key column -
|
||||
// 1) set the value to null
|
||||
// 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() ) {
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( selectable.isUpdateable() ) {
|
||||
|
@ -579,15 +583,18 @@ public class OneToManyPersister extends AbstractCollectionPersister {
|
|||
|
||||
// restrict
|
||||
updateBuilder.addKeyRestrictionLeniently( selectable );
|
||||
} );
|
||||
}
|
||||
|
||||
// set the value for each index column to null
|
||||
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() ) {
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
updateBuilder.addValueColumn(
|
||||
|
@ -595,14 +602,14 @@ public class OneToManyPersister extends AbstractCollectionPersister {
|
|||
NULL,
|
||||
selectable.getJdbcMapping()
|
||||
);
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
// for one-to-many, we know the element is an entity and need to restrict the update
|
||||
// based on the element's id
|
||||
final EntityCollectionPart entityPart = (EntityCollectionPart) getAttributeMapping().getElementDescriptor();
|
||||
final EntityIdentifierMapping entityId = entityPart.getAssociatedEntityMappingType().getIdentifierMapping();
|
||||
entityId.forEachSelectable( updateBuilder::addKeyRestrictionLeniently );
|
||||
updateBuilder.addKeyRestrictionsLeniently( entityId );
|
||||
|
||||
//noinspection unchecked,rawtypes
|
||||
return (RestrictedTableMutation) updateBuilder.buildMutation();
|
||||
|
@ -640,11 +647,8 @@ public class OneToManyPersister extends AbstractCollectionPersister {
|
|||
|
||||
final EntityCollectionPart elementDescriptor = (EntityCollectionPart) attributeMapping.getElementDescriptor();
|
||||
final EntityMappingType elementType = elementDescriptor.getAssociatedEntityMappingType();
|
||||
elementType.getIdentifierMapping().forEachSelectable( (position, mapping) -> {
|
||||
assert tableReference.getTableName().equals( mapping.getContainingTableExpression() );
|
||||
updateBuilder.addKeyRestrictionLeniently( mapping );
|
||||
} );
|
||||
|
||||
assert tableReference.getTableName().equals( elementType.getIdentifierMapping().getContainingTableExpression() );
|
||||
updateBuilder.addKeyRestrictionsLeniently( elementType.getIdentifierMapping() );
|
||||
return (TableUpdate<JdbcMutationOperation>) updateBuilder.buildMutation();
|
||||
}
|
||||
|
||||
|
@ -728,16 +732,11 @@ public class OneToManyPersister extends AbstractCollectionPersister {
|
|||
final TableUpdateBuilderStandard<JdbcMutationOperation> updateBuilder = new TableUpdateBuilderStandard<>( this, tableReference, getFactory() );
|
||||
|
||||
final OneToManyCollectionPart elementDescriptor = (OneToManyCollectionPart) getAttributeMapping().getElementDescriptor();
|
||||
elementDescriptor
|
||||
.getAssociatedEntityMappingType()
|
||||
.getIdentifierMapping()
|
||||
.forEachSelectable( updateBuilder::addKeyRestrictionLeniently );
|
||||
updateBuilder.addKeyRestrictionsLeniently( elementDescriptor.getAssociatedEntityMappingType().getIdentifierMapping() );
|
||||
|
||||
// if the collection has an identifier, add its column as well
|
||||
if ( getAttributeMapping().getIdentifierDescriptor() != null ) {
|
||||
getAttributeMapping()
|
||||
.getIdentifierDescriptor()
|
||||
.forEachSelectable( updateBuilder::addKeyRestrictionLeniently );
|
||||
updateBuilder.addKeyRestrictionsLeniently( getAttributeMapping().getIdentifierDescriptor() );
|
||||
}
|
||||
|
||||
// for each index column:
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.hibernate.engine.spi.SessionFactoryImplementor;
|
|||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.metamodel.mapping.AttributeMapping;
|
||||
import org.hibernate.metamodel.mapping.EntityRowIdMapping;
|
||||
import org.hibernate.metamodel.mapping.SelectableMapping;
|
||||
import org.hibernate.metamodel.mapping.SingularAttributeMapping;
|
||||
import org.hibernate.persister.entity.AbstractEntityPersister;
|
||||
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.TableDeleteBuilderSkipped;
|
||||
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;
|
||||
|
||||
|
@ -157,11 +159,15 @@ public class DeleteCoordinator extends AbstractMutationCoordinator {
|
|||
SharedSessionContractImplementor session,
|
||||
JdbcValueBindings jdbcValueBindings) {
|
||||
if ( loadedState != null ) {
|
||||
final boolean[] versionability = entityPersister().getPropertyVersionability();
|
||||
entityPersister().forEachAttributeMapping( (attributeIndex, attribute) -> {
|
||||
if ( versionability[attributeIndex] && attribute instanceof SingularAttributeMapping ) {
|
||||
final AbstractEntityPersister persister = entityPersister();
|
||||
final boolean[] versionability = persister.getPropertyVersionability();
|
||||
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];
|
||||
if (loadedValue != null) {
|
||||
if ( loadedValue != null ) {
|
||||
final String mutationTableName = persister.getAttributeMutationTableName( attributeIndex );
|
||||
attribute.breakDownJdbcValues(
|
||||
loadedValue,
|
||||
(jdbcValue, jdbcValueMapping) -> {
|
||||
|
@ -172,7 +178,7 @@ public class DeleteCoordinator extends AbstractMutationCoordinator {
|
|||
|
||||
jdbcValueBindings.bindValue(
|
||||
jdbcValue,
|
||||
entityPersister().getAttributeMutationTableName( attributeIndex ),
|
||||
mutationTableName,
|
||||
jdbcValueMapping.getSelectionExpression(),
|
||||
ParameterUsage.RESTRICT,
|
||||
session
|
||||
|
@ -182,7 +188,7 @@ public class DeleteCoordinator extends AbstractMutationCoordinator {
|
|||
);
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -347,31 +353,28 @@ public class DeleteCoordinator extends AbstractMutationCoordinator {
|
|||
if ( applyVersion ) {
|
||||
// apply any optimistic locking
|
||||
applyOptimisticLocking( deleteGroupBuilder, loadedState, session );
|
||||
if ( entityPersister().hasPartitionedSelectionMapping() ) {
|
||||
entityPersister().forEachSelectable(
|
||||
(selectionIndex, selectableMapping) -> {
|
||||
if ( selectableMapping.isPartitioned() ) {
|
||||
final String tableNameForMutation =
|
||||
entityPersister().physicalTableNameForMutation( selectableMapping );
|
||||
final RestrictedTableMutationBuilder<?, ?> rootTableMutationBuilder =
|
||||
deleteGroupBuilder.findTableDetailsBuilder( tableNameForMutation );
|
||||
rootTableMutationBuilder.addKeyRestrictionLeniently( selectableMapping );
|
||||
}
|
||||
final AbstractEntityPersister persister = entityPersister();
|
||||
if ( persister.hasPartitionedSelectionMapping() ) {
|
||||
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() ) {
|
||||
final String tableNameForMutation =
|
||||
persister.physicalTableNameForMutation( selectableMapping );
|
||||
final RestrictedTableMutationBuilder<?, ?> rootTableMutationBuilder =
|
||||
deleteGroupBuilder.findTableDetailsBuilder( tableNameForMutation );
|
||||
rootTableMutationBuilder.addKeyRestrictionLeniently( selectableMapping );
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// todo (6.2) : apply where + where-fragments
|
||||
}
|
||||
|
||||
private static void applyKeyDetails(TableDeleteBuilder tableDeleteBuilder, EntityTableMapping tableMapping) {
|
||||
tableMapping.getKeyMapping().forEachKeyColumn(
|
||||
(columnMapping) -> tableDeleteBuilder.addKeyRestriction(
|
||||
columnMapping.getColumnName(),
|
||||
columnMapping.getWriteExpression(),
|
||||
columnMapping.getJdbcMapping()
|
||||
)
|
||||
);
|
||||
tableDeleteBuilder.addKeyRestrictions( tableMapping.getKeyMapping() );
|
||||
}
|
||||
|
||||
protected void applyOptimisticLocking(
|
||||
|
@ -406,18 +409,20 @@ public class DeleteCoordinator extends AbstractMutationCoordinator {
|
|||
MutationGroupBuilder mutationGroupBuilder,
|
||||
Object[] loadedState,
|
||||
SharedSessionContractImplementor session) {
|
||||
final AbstractEntityPersister persister = entityPersister();
|
||||
assert loadedState != null;
|
||||
assert lockStyle.isAllOrDirty();
|
||||
assert entityPersister().optimisticLockStyle().isAllOrDirty();
|
||||
assert persister.optimisticLockStyle().isAllOrDirty();
|
||||
assert session != null;
|
||||
|
||||
final boolean[] versionability = entityPersister().getPropertyVersionability();
|
||||
entityPersister().forEachAttributeMapping( (attributeIndex, attribute) -> {
|
||||
final boolean[] versionability = persister.getPropertyVersionability();
|
||||
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 instanceof SingularAttributeMapping ) {
|
||||
if ( versionability[attributeIndex] && ( attribute = persister.getAttributeMapping( attributeIndex ) ) instanceof SingularAttributeMapping ) {
|
||||
breakDownJdbcValues( mutationGroupBuilder, session, attribute, loadedState[attributeIndex] );
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
private void breakDownJdbcValues(
|
||||
|
@ -425,24 +430,16 @@ public class DeleteCoordinator extends AbstractMutationCoordinator {
|
|||
SharedSessionContractImplementor session,
|
||||
AttributeMapping attribute,
|
||||
Object loadedValue) {
|
||||
attribute.breakDownJdbcValues(
|
||||
loadedValue,
|
||||
(jdbcValue, columnMapping) -> {
|
||||
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
|
||||
);
|
||||
final RestrictedTableMutationBuilder<?, ?> tableMutationBuilder =
|
||||
mutationGroupBuilder.findTableDetailsBuilder( attribute.getContainingTableExpression() );
|
||||
if ( tableMutationBuilder != null && tableMutationBuilder.getOptimisticLockBindings() != null ) {
|
||||
attribute.breakDownJdbcValues(
|
||||
loadedValue,
|
||||
tableMutationBuilder.getOptimisticLockBindings(),
|
||||
session
|
||||
);
|
||||
}
|
||||
// else there is no actual delete statement for that table,
|
||||
// generally indicates we have an on-delete=cascade situation
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,9 @@ import org.hibernate.internal.util.collections.ArrayHelper;
|
|||
import org.hibernate.jdbc.Expectation;
|
||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||
import org.hibernate.metamodel.mapping.ModelPart;
|
||||
import org.hibernate.metamodel.mapping.SelectableConsumer;
|
||||
import org.hibernate.metamodel.mapping.SelectableMapping;
|
||||
import org.hibernate.metamodel.mapping.SelectableMappings;
|
||||
import org.hibernate.metamodel.mapping.TableDetails;
|
||||
import org.hibernate.sql.model.MutationType;
|
||||
import org.hibernate.sql.model.TableMapping;
|
||||
|
@ -209,7 +211,7 @@ public class EntityTableMapping implements TableMapping {
|
|||
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 ModelPart identifierPart;
|
||||
|
@ -260,6 +262,25 @@ public class EntityTableMapping implements TableMapping {
|
|||
public void forEachKeyColumn(Consumer<KeyColumn> 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 {
|
||||
|
|
|
@ -631,9 +631,10 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
|
|||
SharedSessionContractImplementor session) {
|
||||
|
||||
if ( inclusionChecker.include( attributeIndex, attributeMapping ) ) {
|
||||
attributeMapping.forEachSelectable( (selectableIndex, selectable) -> {
|
||||
processSet( analysis, selectable );
|
||||
} );
|
||||
final int jdbcTypeCount = attributeMapping.getJdbcTypeCount();
|
||||
for ( int i = 0; i < jdbcTypeCount; i++ ) {
|
||||
processSet( analysis, attributeMapping.getSelectable( i ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( lockingChecker.include( attributeIndex, attributeMapping ) ) {
|
||||
|
@ -1064,14 +1065,17 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
|
|||
}
|
||||
|
||||
private void applyPartictionKeyRestriction(TableUpdateBuilder<?> tableUpdateBuilder) {
|
||||
if ( entityPersister().hasPartitionedSelectionMapping() ) {
|
||||
entityPersister().forEachSelectable(
|
||||
(selectionIndex, selectableMapping) -> {
|
||||
if ( selectableMapping.isPartitioned() ) {
|
||||
tableUpdateBuilder.addKeyRestrictionLeniently( selectableMapping );
|
||||
}
|
||||
final AbstractEntityPersister persister = entityPersister();
|
||||
if ( persister.hasPartitionedSelectionMapping() ) {
|
||||
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() ) {
|
||||
tableUpdateBuilder.addKeyRestrictionLeniently( selectableMapping );
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1084,13 +1088,7 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
|
|||
tableUpdateBuilder.addKeyRestrictionLeniently( rowIdMapping );
|
||||
}
|
||||
else {
|
||||
tableMapping.getKeyMapping().forEachKeyColumn(
|
||||
keyColumn -> tableUpdateBuilder.addKeyRestriction(
|
||||
keyColumn.getColumnName(),
|
||||
"?",
|
||||
keyColumn.getJdbcMapping()
|
||||
)
|
||||
);
|
||||
tableUpdateBuilder.addKeyRestrictions( tableMapping.getKeyMapping() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1101,21 +1099,12 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
|
|||
AttributeMapping attributeMapping,
|
||||
TableUpdateBuilder<?> tableUpdateBuilder) {
|
||||
if ( oldValues == null ) {
|
||||
attributeMapping.forEachSelectable(
|
||||
(index, selectableMapping) -> tableUpdateBuilder.addOptimisticLockRestriction( selectableMapping )
|
||||
);
|
||||
tableUpdateBuilder.addOptimisticLockRestrictions( attributeMapping );
|
||||
}
|
||||
else {
|
||||
else if ( tableUpdateBuilder.getOptimisticLockBindings() != null ) {
|
||||
attributeMapping.decompose(
|
||||
oldValues[attributeIndex],
|
||||
(jdbcValue, jdbcMapping) -> {
|
||||
if ( jdbcValue == null ) {
|
||||
tableUpdateBuilder.addNullOptimisticLockRestriction( jdbcMapping );
|
||||
}
|
||||
else {
|
||||
tableUpdateBuilder.addOptimisticLockRestriction( jdbcMapping );
|
||||
}
|
||||
},
|
||||
tableUpdateBuilder.getOptimisticLockBindings(),
|
||||
session
|
||||
);
|
||||
}
|
||||
|
@ -1562,9 +1551,7 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
|
|||
|
||||
updateBuilder.addValueColumn( versionMapping );
|
||||
|
||||
entityPersister().getIdentifierMapping().forEachSelectable(
|
||||
(selectionIndex, selectableMapping) -> updateBuilder.addKeyRestrictionLeniently( selectableMapping )
|
||||
);
|
||||
updateBuilder.addKeyRestrictionsLeniently( entityPersister().getIdentifierMapping() );
|
||||
|
||||
updateBuilder.addOptimisticLockRestriction( versionMapping );
|
||||
addPartitionRestriction( updateBuilder );
|
||||
|
@ -1583,14 +1570,17 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
|
|||
}
|
||||
|
||||
private void addPartitionRestriction(TableUpdateBuilderStandard<JdbcMutationOperation> updateBuilder) {
|
||||
if ( entityPersister().hasPartitionedSelectionMapping() ) {
|
||||
entityPersister().forEachSelectable(
|
||||
(selectionIndex, selectableMapping) -> {
|
||||
if ( selectableMapping.isPartitioned() ) {
|
||||
updateBuilder.addKeyRestrictionLeniently( selectableMapping );
|
||||
}
|
||||
final AbstractEntityPersister persister = entityPersister();
|
||||
if ( persister.hasPartitionedSelectionMapping() ) {
|
||||
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() ) {
|
||||
updateBuilder.addKeyRestrictionLeniently( selectableMapping );
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -30,6 +30,11 @@ public class ColumnValueParameterList extends ArrayList<ColumnValueParameter> im
|
|||
this.parameterUsage = parameterUsage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(int selectionIndex, SelectableMapping selectableMapping) {
|
||||
add(
|
||||
|
|
|
@ -6,19 +6,15 @@
|
|||
*/
|
||||
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.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||
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.MutationTarget;
|
||||
import org.hibernate.sql.model.MutationType;
|
||||
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.RestrictedTableMutation;
|
||||
|
||||
|
@ -32,8 +28,8 @@ public abstract class AbstractRestrictedTableMutationBuilder<O extends MutationO
|
|||
extends AbstractTableMutationBuilder<M>
|
||||
implements RestrictedTableMutationBuilder<O, M> {
|
||||
|
||||
private final List<ColumnValueBinding> keyRestrictionBindings = new ArrayList<>();
|
||||
private List<ColumnValueBinding> optimisticLockBindings;
|
||||
private final ColumnValueBindingList keyRestrictionBindings;
|
||||
private final ColumnValueBindingList optimisticLockBindings;
|
||||
|
||||
public AbstractRestrictedTableMutationBuilder(
|
||||
MutationType mutationType,
|
||||
|
@ -41,6 +37,8 @@ public abstract class AbstractRestrictedTableMutationBuilder<O extends MutationO
|
|||
TableMapping table,
|
||||
SessionFactoryImplementor sessionFactory) {
|
||||
super( mutationType, mutationTarget, table, sessionFactory );
|
||||
this.keyRestrictionBindings = new ColumnValueBindingList( getMutatingTable(), getParameters(), ParameterUsage.RESTRICT );
|
||||
this.optimisticLockBindings = new ColumnValueBindingList( getMutatingTable(), getParameters(), ParameterUsage.RESTRICT );
|
||||
}
|
||||
|
||||
public AbstractRestrictedTableMutationBuilder(
|
||||
|
@ -49,47 +47,33 @@ public abstract class AbstractRestrictedTableMutationBuilder<O extends MutationO
|
|||
MutatingTableReference tableReference,
|
||||
SessionFactoryImplementor 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;
|
||||
}
|
||||
|
||||
public List<ColumnValueBinding> getOptimisticLockBindings() {
|
||||
@Override
|
||||
public ColumnValueBindingList getOptimisticLockBindings() {
|
||||
return optimisticLockBindings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addKeyRestriction(String columnName, String columnWriteFragment, JdbcMapping jdbcMapping) {
|
||||
addColumn(
|
||||
columnName,
|
||||
columnWriteFragment,
|
||||
jdbcMapping,
|
||||
ParameterUsage.RESTRICT,
|
||||
keyRestrictionBindings
|
||||
);
|
||||
keyRestrictionBindings.addRestriction( columnName, columnWriteFragment, jdbcMapping );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addNullOptimisticLockRestriction(SelectableMapping column) {
|
||||
if ( optimisticLockBindings == null ) {
|
||||
optimisticLockBindings = new ArrayList<>();
|
||||
}
|
||||
final ColumnReference columnReference = new ColumnReference(
|
||||
getMutatingTable(),
|
||||
column.getSelectionExpression(),
|
||||
column.getJdbcMapping()
|
||||
);
|
||||
optimisticLockBindings.add( new ColumnValueBinding( columnReference, null ) );
|
||||
optimisticLockBindings.addNullRestriction( column );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addOptimisticLockRestriction(String columnName, String columnWriteFragment, JdbcMapping jdbcMapping) {
|
||||
if ( optimisticLockBindings == null ) {
|
||||
optimisticLockBindings = new ArrayList<>();
|
||||
}
|
||||
|
||||
addColumn( columnName, columnWriteFragment, jdbcMapping, ParameterUsage.RESTRICT, optimisticLockBindings );
|
||||
optimisticLockBindings.addRestriction( columnName, columnWriteFragment, jdbcMapping );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -31,8 +31,6 @@ public abstract class AbstractTableInsertBuilder
|
|||
private final List<ColumnValueBinding> valueBindingList = new ArrayList<>();
|
||||
private List<ColumnValueBinding> lobValueBindingList;
|
||||
|
||||
private final List<ColumnValueParameter> parameters = new ArrayList<>();
|
||||
|
||||
private String sqlComment;
|
||||
|
||||
public AbstractTableInsertBuilder(
|
||||
|
@ -71,10 +69,6 @@ public abstract class AbstractTableInsertBuilder
|
|||
return lobValueBindingList;
|
||||
}
|
||||
|
||||
protected List<ColumnValueParameter> getParameters() {
|
||||
return parameters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addValueColumn(String columnName, String columnWriteFragment, JdbcMapping 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) {
|
||||
addColumn( columnName, columnWriteFragment, jdbcMapping, keyBindingList );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleParameterCreation(ColumnValueParameter parameter) {
|
||||
parameters.add( parameter );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ public abstract class AbstractTableMutationBuilder<M extends TableMutation<?>> i
|
|||
private final MutationTarget<?> mutationTarget;
|
||||
|
||||
private final MutatingTableReference mutatingTable;
|
||||
private final ColumnValueParameterList parameters;
|
||||
|
||||
public AbstractTableMutationBuilder(
|
||||
MutationType mutationType,
|
||||
|
@ -58,6 +59,7 @@ public abstract class AbstractTableMutationBuilder<M extends TableMutation<?>> i
|
|||
this.sessionFactory = sessionFactory;
|
||||
|
||||
this.mutatingTable = mutatingTable;
|
||||
this.parameters = new ColumnValueParameterList( mutatingTable, null, 0 );
|
||||
}
|
||||
|
||||
protected MutationTarget<?> getMutationTarget() {
|
||||
|
@ -69,6 +71,10 @@ public abstract class AbstractTableMutationBuilder<M extends TableMutation<?>> i
|
|||
return mutatingTable;
|
||||
}
|
||||
|
||||
protected ColumnValueParameterList getParameters() {
|
||||
return parameters;
|
||||
}
|
||||
|
||||
protected SessionFactoryImplementor getSessionFactory() {
|
||||
return sessionFactory;
|
||||
}
|
||||
|
@ -122,9 +128,7 @@ public abstract class AbstractTableMutationBuilder<M extends TableMutation<?>> i
|
|||
aggregateMappingType.getJdbcTypeCount()
|
||||
);
|
||||
aggregateMappingType.forEachSelectable( parameters );
|
||||
for ( int i = 0; i < parameters.size(); i++ ) {
|
||||
handleParameterCreation( parameters.get( i ) );
|
||||
}
|
||||
this.parameters.addAll( parameters );
|
||||
|
||||
columnWriteFragment = new ColumnWriteFragment(
|
||||
customWriteExpression,
|
||||
|
@ -134,7 +138,7 @@ public abstract class AbstractTableMutationBuilder<M extends TableMutation<?>> i
|
|||
}
|
||||
else {
|
||||
final ColumnValueParameter parameter = new ColumnValueParameter( columnReference, parameterUsage );
|
||||
handleParameterCreation( parameter );
|
||||
parameters.add( parameter );
|
||||
columnWriteFragment = new ColumnWriteFragment( customWriteExpression, parameter, jdbcMapping );
|
||||
}
|
||||
}
|
||||
|
@ -144,8 +148,6 @@ public abstract class AbstractTableMutationBuilder<M extends TableMutation<?>> i
|
|||
return new ColumnValueBinding( columnReference, columnWriteFragment ) ;
|
||||
}
|
||||
|
||||
protected abstract void handleParameterCreation(ColumnValueParameter parameter);
|
||||
|
||||
@SafeVarargs
|
||||
protected final <T> List<T> combine(List<T> list1, List<T>... additionalLists) {
|
||||
final ArrayList<T> combined = list1 == null
|
||||
|
|
|
@ -9,7 +9,9 @@ package org.hibernate.sql.model.ast.builder;
|
|||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||
import org.hibernate.metamodel.mapping.SelectableConsumer;
|
||||
import org.hibernate.metamodel.mapping.SelectableMapping;
|
||||
import org.hibernate.metamodel.mapping.SelectableMappings;
|
||||
import org.hibernate.sql.model.MutationOperation;
|
||||
import org.hibernate.sql.model.ast.ColumnValueBindingList;
|
||||
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> {
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
@ -32,29 +64,6 @@ public interface RestrictedTableMutationBuilder<O extends MutationOperation, M e
|
|||
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
|
||||
*/
|
||||
|
@ -92,6 +101,10 @@ public interface RestrictedTableMutationBuilder<O extends MutationOperation, M e
|
|||
*/
|
||||
void addOptimisticLockRestriction(String columnName, String columnWriteFragment, JdbcMapping jdbcMapping);
|
||||
|
||||
ColumnValueBindingList getKeyRestrictionBindings();
|
||||
|
||||
ColumnValueBindingList getOptimisticLockBindings();
|
||||
|
||||
void setWhere(String fragment);
|
||||
|
||||
void addWhereFragment(String fragment);
|
||||
|
|
|
@ -9,6 +9,7 @@ package org.hibernate.sql.model.ast.builder;
|
|||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||
import org.hibernate.metamodel.mapping.SelectableMapping;
|
||||
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.TableDelete;
|
||||
|
||||
|
@ -34,6 +35,16 @@ public class TableDeleteBuilderSkipped implements TableDeleteBuilder {
|
|||
public void addOptimisticLockRestriction(String columnName, String columnWriteFragment, JdbcMapping jdbcMapping) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColumnValueBindingList getKeyRestrictionBindings() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColumnValueBindingList getOptimisticLockBindings() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWhere(String fragment) {
|
||||
}
|
||||
|
|
|
@ -32,8 +32,6 @@ public class TableDeleteBuilderStandard
|
|||
implements TableDeleteBuilder {
|
||||
private final boolean isCustomSql;
|
||||
|
||||
private final List<ColumnValueParameter> parameters = new ArrayList<>();
|
||||
|
||||
private String sqlComment;
|
||||
|
||||
public TableDeleteBuilderStandard(
|
||||
|
@ -103,13 +101,4 @@ public class TableDeleteBuilderStandard
|
|||
getParameters()
|
||||
);
|
||||
}
|
||||
|
||||
protected List<ColumnValueParameter> getParameters() {
|
||||
return parameters;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleParameterCreation(ColumnValueParameter parameter) {
|
||||
parameters.add( parameter );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ package org.hibernate.sql.model.ast.builder;
|
|||
|
||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||
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.RestrictedTableMutation;
|
||||
import org.hibernate.sql.model.jdbc.JdbcMutationOperation;
|
||||
|
@ -47,6 +48,16 @@ public class TableUpdateBuilderSkipped implements TableUpdateBuilder {
|
|||
// nothing to do
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColumnValueBindingList getKeyRestrictionBindings() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColumnValueBindingList getOptimisticLockBindings() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addWhereFragment(String fragment) {
|
||||
// nothing to do
|
||||
|
|
|
@ -80,10 +80,4 @@ public class TableUpdateBuilderStandard<O extends MutationOperation> extends Abs
|
|||
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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue