mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-27 22:39:13 +00:00
HHH-11237 - Fix isModified so that a null equates empty components when using select-before-update.
This commit is contained in:
parent
667136c473
commit
550c2e38ff
@ -299,19 +299,16 @@ public boolean isModified(
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user