HHH-11237 - Fix isModified so that a null equates empty components when using select-before-update.

This commit is contained in:
Chris Cranford 2017-02-04 01:16:45 -05:00
parent 667136c473
commit 550c2e38ff
1 changed files with 4 additions and 7 deletions

View File

@ -299,19 +299,16 @@ public class ComponentType extends AbstractType implements CompositeType, Proced
final Object current,
final boolean[] checkable,
final SharedSessionContractImplementor session) throws HibernateException {
if ( current == null ) {
return old != null;
if ( old == current ) {
return false;
}
if ( old == null ) {
return true;
}
Object[] oldValues = (Object[]) old;
// null value and empty components are considered equivalent
int loc = 0;
for ( int i = 0; i < propertySpan; i++ ) {
int len = propertyTypes[i].getColumnSpan( session.getFactory() );
boolean[] subcheckable = new boolean[len];
System.arraycopy( checkable, loc, subcheckable, 0, len );
if ( propertyTypes[i].isModified( oldValues[i], getPropertyValue( current, i ), subcheckable, session ) ) {
if ( propertyTypes[i].isModified( getPropertyValue( old, i ), getPropertyValue( current, i ), subcheckable, session ) ) {
return true;
}
loc += len;