From 30aec8b8ff0a8b9e65ac954c15f01a13c3097d61 Mon Sep 17 00:00:00 2001 From: Andrea Boriero Date: Thu, 28 Sep 2023 13:06:23 +0200 Subject: [PATCH] HHH-17257 ElementCollection is missing elements after update if embeddable type has primitive columns marked as nullable --- .../metamodel/mapping/internal/EmbeddableMappingTypeImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/EmbeddableMappingTypeImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/EmbeddableMappingTypeImpl.java index d4fe1bfd7f..a93d43dfba 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/EmbeddableMappingTypeImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/EmbeddableMappingTypeImpl.java @@ -385,7 +385,7 @@ public class EmbeddableMappingTypeImpl extends AbstractEmbeddableMapping impleme length = column.getLength(); precision = column.getPrecision(); scale = column.getScale(); - nullable = column.isNullable(); + nullable = bootPropertyDescriptor.isOptional() && column.isNullable() ; selectablePath = basicValue.createSelectablePath( column.getQuotedName( dialect ) ); } else { @@ -393,7 +393,7 @@ public class EmbeddableMappingTypeImpl extends AbstractEmbeddableMapping impleme length = null; precision = null; scale = null; - nullable = true; + nullable = bootPropertyDescriptor.isOptional(); selectablePath = basicValue.createSelectablePath( bootPropertyDescriptor.getName() ); } attributeMapping = MappingModelCreationHelper.buildBasicAttributeMapping(