Skip to content

Commit

Permalink
HHH-14216 Implement isDirty for OneToOneType and always check if it i…
Browse files Browse the repository at this point in the history
…s dirty or not.
  • Loading branch information
David Ellingsworth authored and sebersole committed Nov 4, 2020
1 parent ef5c944 commit 24035d7
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions hibernate-core/src/main/java/org/hibernate/type/OneToOneType.java
Expand Up @@ -151,12 +151,19 @@ public boolean isOneToOne() {

@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
Expand Down Expand Up @@ -218,14 +225,8 @@ public Object assemble(Serializable oid, SharedSessionContractImplementor sessio
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;
}
}

0 comments on commit 24035d7

Please sign in to comment.