HHH-18147 Hibernate fails to persist an entity when a natural id association is a proxy
This commit is contained in:
parent
f87cecee0e
commit
357be627e2
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue