HHH-18147 Hibernate fails to persist an entity when a natural id association is a proxy

This commit is contained in:
Andrea Boriero 2024-06-04 15:10:16 +02:00 committed by Christian Beikov
parent f87cecee0e
commit 357be627e2
1 changed files with 6 additions and 0 deletions

View File

@ -65,6 +65,8 @@ import org.hibernate.persister.entity.EntityNameUse;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.persister.entity.JoinedSubclassEntityPersister;
import org.hibernate.property.access.spi.PropertyAccess;
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.proxy.LazyInitializer;
import org.hibernate.spi.EntityIdentifierNavigablePath;
import org.hibernate.spi.NavigablePath;
import org.hibernate.spi.TreatedNavigablePath;
@ -2432,6 +2434,10 @@ public class ToOneAttributeMapping
}
if ( referencedPropertyName != null ) {
final LazyInitializer lazyInitializer = HibernateProxy.extractLazyInitializer( domainValue );
if ( lazyInitializer != null ) {
domainValue = lazyInitializer.getImplementation();
}
assert getAssociatedEntityMappingType()
.getRepresentationStrategy()
.getInstantiator()