HHH-11214 - Fix validity audit strategy auditing nested collections with null property values.

(cherry picked from commit af78f17eb8)
This commit is contained in:
Chris Cranford 2016-10-31 12:29:17 -04:00 committed by Gail Badner
parent 422f8c0de4
commit 2eaa5e2492
1 changed files with 7 additions and 1 deletions

View File

@ -267,10 +267,16 @@ public class ValidityAuditStrategy implements AuditStrategy {
// Handling collection of components.
if ( collectionPropertyType.getElementType( sessionFactory ) instanceof ComponentType ) {
// 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() ) {
if ( !originalIdPropName.equals( dataEntry.getKey() ) ) {
if ( dataEntry.getValue() != null ) {
qb.getRootParameters().addWhereWithParam( dataEntry.getKey(), true, "=", dataEntry.getValue() );
}
else {
qb.getRootParameters().addNullRestriction( dataEntry.getKey(), true );
}
}
}
}
}