mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-27 14:30:16 +00:00
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.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 @@ protected Object performSave(
|
||||
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…
x
Reference in New Issue
Block a user