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
dragneelfps
changed the title
fails to encode varchar(in database) into string(in entity class) due to JsonCodec
fails to encode string to varchar due to precedence of JsonCodec over StringCodec
Jun 24, 2021
Bug Report
Versions
Current Behavior
JsonCodec tries to encode/decode for non-json string values and fails with exception.
This is because
JsonCodec
andStringCodec
both have supportedtype
asString
, andJsonCodec
is beforeStringCodec
in the codec list. It throws exception at https://github.com/r2dbc/r2dbc-h2/blob/main/src/main/java/io/r2dbc/h2/codecs/DefaultCodecs.java#L68-L72Expected behavior/code
It should not use
JsonCodec
in case the value is not a JSON-string.Possible Solution
Solution 1
Override
r2dbc-h2/src/main/java/io/r2dbc/h2/codecs/AbstractCodec.java
Line 40 in 4863ba0
JsonCodec
and check if the string is a json serialized string or notCons:
The text was updated successfully, but these errors were encountered: