HHH-16821 Fail to delete entity with a composite id using an @IdClass with one of its fields mapped from the id of a @ManyToOne association
This commit is contained in:
parent
44439cad95
commit
2e4211e8eb
|
@ -635,31 +635,35 @@ public class EmbeddableMappingTypeImpl extends AbstractEmbeddableMapping impleme
|
|||
|
||||
for ( int i = 0; i < size; i++ ) {
|
||||
final AttributeMapping attributeMapping = attributeMappings.get( i );
|
||||
final Object attributeValue = values[ i ];
|
||||
span += attributeMapping.breakDownJdbcValues(
|
||||
attributeValue,
|
||||
offset + span,
|
||||
x,
|
||||
y,
|
||||
valueConsumer,
|
||||
session
|
||||
);
|
||||
if ( !attributeMapping.isPluralAttributeMapping() ) {
|
||||
final Object attributeValue = values[i];
|
||||
span += attributeMapping.breakDownJdbcValues(
|
||||
attributeValue,
|
||||
offset + span,
|
||||
x,
|
||||
y,
|
||||
valueConsumer,
|
||||
session
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for ( int i = 0; i < size; i++ ) {
|
||||
final AttributeMapping attributeMapping = attributeMappings.get( i );
|
||||
final Object attributeValue = domainValue == null
|
||||
? null
|
||||
: attributeMapping.getPropertyAccess().getGetter().get( domainValue );
|
||||
span += attributeMapping.breakDownJdbcValues(
|
||||
attributeValue,
|
||||
offset + span,
|
||||
x,
|
||||
y,
|
||||
valueConsumer,
|
||||
session
|
||||
);
|
||||
if ( !attributeMapping.isPluralAttributeMapping() ) {
|
||||
final Object attributeValue = domainValue == null
|
||||
? null
|
||||
: attributeMapping.getPropertyAccess().getGetter().get( domainValue );
|
||||
span += attributeMapping.breakDownJdbcValues(
|
||||
attributeValue,
|
||||
offset + span,
|
||||
x,
|
||||
y,
|
||||
valueConsumer,
|
||||
session
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
return span;
|
||||
|
|
|
@ -165,7 +165,7 @@ public class DeleteCoordinator extends AbstractMutationCoordinator {
|
|||
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 ) {
|
||||
if ( versionability[attributeIndex] && !( attribute = persister.getAttributeMapping( attributeIndex ) ).isPluralAttributeMapping() ) {
|
||||
final Object loadedValue = loadedState[attributeIndex];
|
||||
if ( loadedValue != null ) {
|
||||
final String mutationTableName = persister.getAttributeMutationTableName( attributeIndex );
|
||||
|
@ -424,7 +424,7 @@ public class DeleteCoordinator extends AbstractMutationCoordinator {
|
|||
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 ) {
|
||||
if ( versionability[attributeIndex] && !( attribute = persister.getAttributeMapping( attributeIndex ) ).isPluralAttributeMapping() ) {
|
||||
breakDownJdbcValues( mutationGroupBuilder, session, attribute, loadedState[attributeIndex] );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue