HHH-7237 - Inline natural-id synchronization doesn't consider reattached objects
This commit is contained in:
parent
572e78dce4
commit
76504f128f
|
@ -71,6 +71,7 @@ import org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle;
|
|||
import org.hibernate.engine.spi.FilterDefinition;
|
||||
import org.hibernate.engine.spi.LoadQueryInfluencers;
|
||||
import org.hibernate.engine.spi.Mapping;
|
||||
import org.hibernate.engine.spi.PersistenceContext.NaturalIdHelper;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.spi.SessionImplementor;
|
||||
import org.hibernate.engine.spi.ValueInclusion;
|
||||
|
@ -3997,6 +3998,15 @@ public abstract class AbstractEntityPersister
|
|||
fieldInterceptor.dirty();
|
||||
}
|
||||
}
|
||||
if ( hasNaturalIdentifier() ) {
|
||||
final Serializable id = getIdentifier( entity, session );
|
||||
final NaturalIdHelper helper = session.getPersistenceContext().getNaturalIdHelper();
|
||||
helper.cacheNaturalIdCrossReferenceFromLoad( // TODO rename cacheNaturalIdCrossReferenceFromLoad ?
|
||||
this,
|
||||
id,
|
||||
helper.extractNaturalIdValues( getPropertyValues(entity), this )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public Boolean isTransient(Object entity, SessionImplementor session) throws HibernateException {
|
||||
|
|
Loading…
Reference in New Issue