Skip to content

Commit 5ffed50

Browse files
dreab8Sanne
authored andcommitted
HHH-14826 Fix failure of o.h.test.onetoone.cache.OneToOneCacheTest#OneToOneCacheByForeignKey()
1 parent 340b901 commit 5ffed50

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,19 @@ public Serializable disassemble(Object value, SharedSessionContractImplementor s
215215

216216
@Override
217217
public Object assemble(Serializable oid, SharedSessionContractImplementor session, Object owner) throws HibernateException {
218+
219+
if ( oid == null ) {
220+
if ( uniqueKeyPropertyName != null ) {
221+
return resolve( session.getContextEntityIdentifier( owner ), session, owner );
222+
}
223+
return null;
224+
}
225+
218226
//the owner of the association is not the owner of the id
219227
Serializable id = ( Serializable ) getIdentifierType( session ).assemble( oid, session, null );
220228

221229
if ( id == null ) {
222-
return resolve( session.getContextEntityIdentifier(owner), session, owner );
230+
return null;
223231
}
224232

225233
return resolveIdentifier( id, session );

0 commit comments

Comments
 (0)