Skip to content

Commit 550c2e3

Browse files
committed
HHH-11237 - Fix isModified so that a null equates empty components when using select-before-update.
1 parent 667136c commit 550c2e3

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

hibernate-core/src/main/java/org/hibernate/type/ComponentType.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -299,19 +299,16 @@ public boolean isModified(
299299
final Object current,
300300
final boolean[] checkable,
301301
final SharedSessionContractImplementor session) throws HibernateException {
302-
if ( current == null ) {
303-
return old != null;
304-
}
305-
if ( old == null ) {
306-
return true;
302+
if ( old == current ) {
303+
return false;
307304
}
308-
Object[] oldValues = (Object[]) old;
305+
// null value and empty components are considered equivalent
309306
int loc = 0;
310307
for ( int i = 0; i < propertySpan; i++ ) {
311308
int len = propertyTypes[i].getColumnSpan( session.getFactory() );
312309
boolean[] subcheckable = new boolean[len];
313310
System.arraycopy( checkable, loc, subcheckable, 0, len );
314-
if ( propertyTypes[i].isModified( oldValues[i], getPropertyValue( current, i ), subcheckable, session ) ) {
311+
if ( propertyTypes[i].isModified( getPropertyValue( old, i ), getPropertyValue( current, i ), subcheckable, session ) ) {
315312
return true;
316313
}
317314
loc += len;

0 commit comments

Comments
 (0)