-
Notifications
You must be signed in to change notification settings - Fork 131
Closed
Description
Two related problems:
-
In case when a custom converter is provided for a type and a null value is converted, there is no way to disambiguate whether I want it to be be left null or converted to a specific instance of the target type.
For example, if my target type is Jackson's JsonNode and the souce value is null, it's not possible to customize conversion to return justnullorcom.fasterxml.jackson.databind.node.NullNode. -
MappingR2dbcConverterfails to convert null values to JsonNode even in the presence of the corresponding converter, see an example here.
Suppressed: org.springframework.data.mapping.MappingException: Could not read property private final com.fasterxml.jackson.databind.JsonNode com.example.r2dbcconverternull.MyRow.field1 from column field1!
at app//org.springframework.data.r2dbc.convert.MappingR2dbcConverter.readFrom(MappingR2dbcConverter.java:185)
at app//org.springframework.data.r2dbc.convert.MappingR2dbcConverter.access$000(MappingR2dbcConverter.java:64)
at app//org.springframework.data.r2dbc.convert.MappingR2dbcConverter$RowParameterValueProvider.getParameterValue(MappingR2dbcConverter.java:706)
at app//org.springframework.data.mapping.model.SpELExpressionParameterValueProvider.getParameterValue(SpELExpressionParameterValueProvider.java:53)
at app//org.springframework.data.relational.core.conversion.BasicRelationalConverter$ConvertingParameterValueProvider.getParameterValue(BasicRelationalConverter.java:268)
at app//org.springframework.data.mapping.model.ClassGeneratingEntityInstantiator.extractInvocationArguments(ClassGeneratingEntityInstantiator.java:276)
at app//org.springframework.data.mapping.model.ClassGeneratingEntityInstantiator$EntityInstantiatorAdapter.createInstance(ClassGeneratingEntityInstantiator.java:248)
at app//org.springframework.data.mapping.model.ClassGeneratingEntityInstantiator.createInstance(ClassGeneratingEntityInstantiator.java:89)
at app//org.springframework.data.relational.core.conversion.BasicRelationalConverter.createInstance(BasicRelationalConverter.java:145)
at app//org.springframework.data.r2dbc.convert.MappingR2dbcConverter.createInstance(MappingR2dbcConverter.java:326)
at app//org.springframework.data.r2dbc.convert.MappingR2dbcConverter.read(MappingR2dbcConverter.java:124)
at app//org.springframework.data.r2dbc.convert.MappingR2dbcConverter.read(MappingR2dbcConverter.java:119)
at app//com.example.r2dbcconverternull.R2dbcConverterNullApplicationTests.convertNullValue$lambda-0(R2dbcConverterNullApplicationTests.kt:33)
at app//io.r2dbc.h2.H2Result.lambda$map$0(H2Result.java:67)
at app//reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:106)
... 181 more
Caused by: org.springframework.data.mapping.model.MappingInstantiationException: Failed to instantiate com.fasterxml.jackson.databind.JsonNode using constructor protected com.fasterxml.jackson.databind.JsonNode() with arguments
at app//org.springframework.data.mapping.model.ClassGeneratingEntityInstantiator$MappingInstantiationExceptionEntityInstantiator.createInstance(ClassGeneratingEntityInstantiator.java:321)
at app//org.springframework.data.mapping.model.ClassGeneratingEntityInstantiator.createInstance(ClassGeneratingEntityInstantiator.java:89)
at app//org.springframework.data.relational.core.conversion.BasicRelationalConverter.createInstance(BasicRelationalConverter.java:145)
at app//org.springframework.data.r2dbc.convert.MappingR2dbcConverter.createInstance(MappingR2dbcConverter.java:326)
at app//org.springframework.data.r2dbc.convert.MappingR2dbcConverter.readEntityFrom(MappingR2dbcConverter.java:293)
at app//org.springframework.data.r2dbc.convert.MappingR2dbcConverter.readFrom(MappingR2dbcConverter.java:175)
... 195 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.fasterxml.jackson.databind.JsonNode]: Class is abstract
... 201 more
Metadata
Metadata
Assignees
Labels
type: bugA general bugA general bug