HHH-18032 CompositeId, when the id assigned by PrePersist method an HibernateException: identifier of an instance of _ was altered is thrown
This commit is contained in:
parent
480e09fc4c
commit
9d54924c79
|
@ -26,6 +26,7 @@ import org.hibernate.engine.spi.SessionImplementor;
|
|||
import org.hibernate.engine.spi.Status;
|
||||
import org.hibernate.event.spi.EventSource;
|
||||
import org.hibernate.id.Assigned;
|
||||
import org.hibernate.id.CompositeNestedGeneratedValueGenerator;
|
||||
import org.hibernate.id.IdentifierGenerationException;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
|
@ -199,7 +200,8 @@ public abstract class AbstractSaveEventListener<C>
|
|||
processIfSelfDirtinessTracker( entity, SelfDirtinessTracker::$$_hibernate_clearDirtyAttributes );
|
||||
processIfManagedEntity( entity, (managedEntity) -> managedEntity.$$_hibernate_setUseTracker( true ) );
|
||||
|
||||
if ( persister.getGenerator() instanceof Assigned ) {
|
||||
final Generator generator = persister.getGenerator();
|
||||
if ( generator instanceof Assigned || generator instanceof CompositeNestedGeneratedValueGenerator ) {
|
||||
id = persister.getIdentifier( entity, source );
|
||||
if ( id == null ) {
|
||||
throw new IdentifierGenerationException(
|
||||
|
|
Loading…
Reference in New Issue