Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b6Kg9RWSTJzyz6KP9X
23 lines
1.5 KiB
Plaintext
23 lines
1.5 KiB
Plaintext
|
|
== which FormatMapper with only Jackson 3 on the classpath, nothing configured
|
|
getJsonFormatMapper() -> org.hibernate.type.format.jackson.Jackson3JsonFormatMapper
|
|
Jackson 2 present? false; Jackson 3 present? true
|
|
|
|
== schema evolution: stored JSON that does not match the record
|
|
extra-key -> FAILED tools.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized property "colour" (class com.ankurm.jsoncolumns.model.Dimensions), not marked as ignorable (3 known properties: "widthMm", "heightMm", "depthMm")
|
|
missing-key -> loaded Dimensions[widthMm=1, heightMm=0, depthMm=0]
|
|
wrong-type -> FAILED tools.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type `int` from String "wide": not a valid `int` value
|
|
not-an-object -> FAILED tools.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `com.ankurm.jsoncolumns.model.Dimensions` from Array value (token `JsonToken.START_ARRAY`)
|
|
|
|
== the fix for extra keys: @JsonIgnoreProperties(ignoreUnknown = true) on the record
|
|
stored {"widthMm":7,"colour":"red"} -> loaded Tolerant[widthMm=7]
|
|
|
|
== hibernate.type.json_format_mapper = your own Jackson 3 JsonMapper (snake_case)
|
|
dimensions = {"depth_mm": 3, "width_mm": 1, "height_mm": 2}
|
|
specs = {"material": "tin", "weight_kg": 0.5, "certifications": []}
|
|
read back = Dimensions[widthMm=1, heightMm=2, depthMm=3]
|
|
|
|
== java.time inside a JSON value with the default mapper
|
|
Map.of("at", Instant) stored as {"at": 1793355330.000000000}
|
|
read back as {at=1.79335533E9} (Double)
|