From 169757d5b156ed809da10d68225dd336dd05f9b9 Mon Sep 17 00:00:00 2001 From: Marco Belladelli Date: Fri, 24 Mar 2023 10:15:33 +0100 Subject: [PATCH] HHH-16340 Avoid checking discriminator duplication when not insertable --- .../src/main/java/org/hibernate/mapping/PersistentClass.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/PersistentClass.java b/hibernate-core/src/main/java/org/hibernate/mapping/PersistentClass.java index 64ce21a05b..e4c89e0fe0 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/PersistentClass.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/PersistentClass.java @@ -1103,7 +1103,9 @@ public abstract class PersistentClass implements IdentifiableTypeClass, Attribut //and checked later, so it needs to be excluded checkColumnDuplication( cols, getKey() ); } - checkColumnDuplication( cols, getDiscriminator() ); + if ( isDiscriminatorInsertable() ) { + checkColumnDuplication( cols, getDiscriminator() ); + } checkPropertyColumnDuplication( cols, getNonDuplicatedProperties() ); for ( Join join : getJoins() ) { cols.clear();