Skip to content

JSON type is handled incorrectly for H2 database #2597

@justinplus

Description

@justinplus

MyBatis version

3.5.10

Database vendor and version

h2, version: 1.4.200

Description

MyBatis maps JSON type to Java String, but for h2, FORMAT JSON is required when inserting a JSON column as mentioned in its doc.

To set a JSON value with java.lang.String in a PreparedStatement use a FORMAT JSON data format (INSERT INTO TEST(ID, DATA) VALUES (?, ? FORMAT JSON)). Without the data format VARCHAR values are converted to a JSON string values.
link: https://h2database.com/html/datatypes.html#json_type

Also see issue in: h2database/h2database#3088

Is this a known issue?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions