Hi all, not sure if I am at the correct place to discuss this problem. I hope so. I switched to Hibernate 6 with the newest Spring Boot 3.1.0 data-jpa starter. Before using Spring Boot 2.7.11 the following problem was not there. I use Kotlin here, which maybe makes a difference because of non nullable types. I have the following in my Entity @ElementCollection @CollectionTable(name = "entity_description") private val descriptionsInternal: MutableList<Description> = mutableListOf() The Description class looks as follows @Embeddable data class Description( @Column(nullable = false) @Convert(converter = NonBlankString255AttributeConverter::class) var desc: NonBlankString255, @Column(nullable = false) var order: Int, ) I use a special AttributeConverter to convert the database string into Objects sealed class StringAttributeConverter<T : Any>( private val instanceCreator: (String) -> T, ) : AttributeConverter<T, String> { override fun convertToDatabaseColumn(attribute: T): String = attribute.toString() override fun convertToEntityAttribute(dbData: String): T = instanceCreator(dbData) } object NonBlankString255AttributeConverter : StringAttributeConverter<NonBlankString255>(::NonBlankString255) When selecting the Entity from database with left joining the descriptions, then i got a Kotlin NullPointerException in "convertToEntityAttribute(dbData: String)" because the dbData is null. My database table for the descriptions is empty and I expect an empty descriptionsInternal list without errors, because I not expect that the converter would be called for a field that is not filled in db. At least this was not the case with an older version. I could fix it by using @Convert(converter = *Nullable*NonBlankString255AttributeConverter::class) var desc: NonBlankString255, instead of @Convert(converter = NonBlankString255AttributeConverter::class) var desc: NonBlankString255, But this is not really nice, because the desc: NonBlankString255 is still a not nullable Type without Kotlins "?" Now I only can have Converters which need to handle always nullable values, because of a maybe empty ElementCollection? Thanks |