When using H2, attempting to insert null into a nullable JSON column results in an NPE that states:
null cannot be cast to non-null type kotlin.String
When using PostgreSQL-NG, attempting to retrieve a null value stored in a JSON column results in a deserialization error because a non-null object is read with string value 'null'.
Both these issues occur because the JsonColumnType override for setParameter() does not handle null values correctly.
In the case of PostgreSQL-NG, this meant that a null value was being stored as a string literal instead of SQL NULL.
If null values are passed, the dialect overrides now ensure that they are sent to the super implementation so they can be handled as SQL NULL.
When using H2, attempting to insert
null
into a nullable JSON column results in an NPE that states:When using PostgreSQL-NG, attempting to retrieve a null value stored in a JSON column results in a deserialization error because a non-null object is read with string value
'null'
.Both these issues occur because the
JsonColumnType
override forsetParameter()
does not handle null values correctly. In the case of PostgreSQL-NG, this meant that a null value was being stored as a string literal instead of SQL NULL.If null values are passed, the dialect overrides now ensure that they are sent to the super implementation so they can be handled as SQL NULL.