HHH-15044 Revert HHH-14826 fix because the provided test was wrong

This commit is contained in:
Andrea Boriero 2022-01-19 18:36:43 +01:00 committed by Andrea Boriero
parent a05f167db6
commit a9ddebf643
2 changed files with 1 additions and 13 deletions

View File

@ -19,7 +19,6 @@ import org.hibernate.engine.spi.Mapping;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.internal.util.collections.ArrayHelper;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.persister.entity.UniqueKeyLoadable;
import org.hibernate.type.spi.TypeConfiguration;
/**
@ -170,18 +169,6 @@ public class OneToOneType extends EntityType {
@Override
public Object assemble(Serializable oid, SharedSessionContractImplementor session, Object owner) throws HibernateException {
if ( oid == null ) {
if ( uniqueKeyPropertyName != null ) {
final EntityPersister associatedEntityPersister = getAssociatedEntityPersister( session.getFactory() );
return ( (UniqueKeyLoadable) associatedEntityPersister ).loadByUniqueKey(
uniqueKeyPropertyName,
session.getContextEntityIdentifier( owner ),
session
);
}
return null;
}
//the owner of the association is not the owner of the id
Object id = getIdentifierType( session ).assemble( oid, session, null );

View File

@ -56,6 +56,7 @@ public class OneToOneCacheEnableSelectingTest {
Product product = s.find(Product.class, pid.get());
ProductConfig config = new ProductConfig();
config.setProduct(product);
product.setConfig( config );
s.persist(config);
});