HHH-14216 Implement isDirty for OneToOneType and always check if it is dirty or not.

This commit is contained in:
David Ellingsworth 2020-10-13 17:02:29 -04:00 committed by Steve Ebersole
parent ef5c944c86
commit 24035d7f2c
1 changed files with 10 additions and 9 deletions

View File

@ -151,12 +151,19 @@ public class OneToOneType extends EntityType {
@Override
public boolean isDirty(Object old, Object current, SharedSessionContractImplementor session) {
return false;
if ( isSame( old, current ) ) {
return false;
}
Object oldid = getIdentifier( old, session );
Object newid = getIdentifier( current, session );
return getIdentifierType( session ).isDirty( oldid, newid, session );
}
@Override
public boolean isDirty(Object old, Object current, boolean[] checkable, SharedSessionContractImplementor session) {
return false;
return isDirty(old, current, session);
}
@Override
@ -218,14 +225,8 @@ public class OneToOneType extends EntityType {
return resolveIdentifier( id, session );
}
/**
* We don't need to dirty check one-to-one because of how
* assemble/disassemble is implemented and because a one-to-one
* association is never dirty
*/
@Override
public boolean isAlwaysDirtyChecked() {
//TODO: this is kinda inconsistent with CollectionType
return false;
return true;
}
}