HHH-11214 - Fix validity audit strategy auditing nested collections with null property values.
(cherry picked from commit af78f17eb8
)
This commit is contained in:
parent
bb7d18d7c0
commit
9a3676eda3
|
@ -267,9 +267,15 @@ public class ValidityAuditStrategy implements AuditStrategy {
|
||||||
// Handling collection of components.
|
// Handling collection of components.
|
||||||
if ( collectionPropertyType.getElementType( sessionFactory ) instanceof ComponentType ) {
|
if ( collectionPropertyType.getElementType( sessionFactory ) instanceof ComponentType ) {
|
||||||
// Adding restrictions to compare data outside of primary key.
|
// Adding restrictions to compare data outside of primary key.
|
||||||
|
// todo: is it necessary that non-primary key attributes be compared?
|
||||||
for ( Map.Entry<String, Object> dataEntry : persistentCollectionChangeData.getData().entrySet() ) {
|
for ( Map.Entry<String, Object> dataEntry : persistentCollectionChangeData.getData().entrySet() ) {
|
||||||
if ( !originalIdPropName.equals( dataEntry.getKey() ) ) {
|
if ( !originalIdPropName.equals( dataEntry.getKey() ) ) {
|
||||||
qb.getRootParameters().addWhereWithParam( dataEntry.getKey(), true, "=", dataEntry.getValue() );
|
if ( dataEntry.getValue() != null ) {
|
||||||
|
qb.getRootParameters().addWhereWithParam( dataEntry.getKey(), true, "=", dataEntry.getValue() );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
qb.getRootParameters().addNullRestriction( dataEntry.getKey(), true );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue