HHH-17380 Persisting an entity with a non generated id and @MapsId throws PropertyValueException
This commit is contained in:
parent
a4762886fd
commit
ed107f8436
|
@ -105,6 +105,7 @@ import org.hibernate.generator.internal.VersionGeneration;
|
|||
import org.hibernate.graph.spi.RootGraphImplementor;
|
||||
import org.hibernate.id.Assigned;
|
||||
import org.hibernate.id.BulkInsertionCapableIdentifierGenerator;
|
||||
import org.hibernate.id.ForeignGenerator;
|
||||
import org.hibernate.id.IdentifierGenerator;
|
||||
import org.hibernate.id.OptimizableGenerator;
|
||||
import org.hibernate.id.PostInsertIdentityPersister;
|
||||
|
@ -3924,6 +3925,8 @@ public abstract class AbstractEntityPersister
|
|||
return false;
|
||||
}
|
||||
}
|
||||
final Generator identifierGenerator = getGenerator();
|
||||
if ( identifierGenerator != null && !( identifierGenerator instanceof ForeignGenerator ) ) {
|
||||
final Boolean unsaved = identifierMapping.getUnsavedStrategy().isUnsaved( id );
|
||||
if ( unsaved != null && !unsaved ) {
|
||||
throw new PropertyValueException(
|
||||
|
@ -3933,6 +3936,7 @@ public abstract class AbstractEntityPersister
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
return isUnsaved;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue