You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an entity with a field annotated with@ReadOnlyProperty. When trying to save an entity of that type to my database I get a NullPointerException:
Suppressed: java.lang.NullPointerException
at org.springframework.data.r2dbc.core.DefaultReactiveDataAccessStrategy.shouldConvertArrayValue(DefaultReactiveDataAccessStrategy.java:225)
at org.springframework.data.r2dbc.core.DefaultReactiveDataAccessStrategy.getOutboundRow(DefaultReactiveDataAccessStrategy.java:209)
at org.springframework.data.r2dbc.core.DefaultDatabaseClient$DefaultTypedInsertSpec.exchange(DefaultDatabaseClient.java:1171)
at org.springframework.data.r2dbc.core.DefaultDatabaseClient$DefaultTypedInsertSpec.access$1300(DefaultDatabaseClient.java:1067)
at org.springframework.data.r2dbc.core.DefaultDatabaseClient$DefaultTypedInsertSpec$1.lambda$first$1(DefaultDatabaseClient.java:1153)
at reactor.core.publisher.FluxFlatMap.trySubscribeScalarMap(FluxFlatMap.java:151)
... 85 more
The issue seems to be that the MappingR2dbcConverterdoes correctly skip read only properties when writing properties to the OutboundRow, but DefaultReactiveDataAccessStrategy#getOutboundRowdoes not skip read only properties when retrieving the SettableValues from the OutboundRow.
The text was updated successfully, but these errors were encountered:
On further investigation the issue is specifically because the property is considered "collection like" (my field is a byte[]). DefaultReactiveDataAccessStrategy#shouldConvertArrayValue dereferences value even though in this case it is null. Non collection properties are not impacted because that method returns early if property.isCollectionLike() returns true
I have an entity with a field annotated with
@ReadOnlyProperty
. When trying to save an entity of that type to my database I get aNullPointerException
:The issue seems to be that the
MappingR2dbcConverter
does correctly skip read only properties when writing properties to theOutboundRow
, butDefaultReactiveDataAccessStrategy#getOutboundRow
does not skip read only properties when retrieving theSettableValue
s from theOutboundRow
.The text was updated successfully, but these errors were encountered: