Writing to JSON column of Postgres database using Spring / JPA
For people using Spring-boot there are two ways to do what @Craig Ringer said
spring.datasource.url=jdbc:postgresql://localhost:5432/postgres?stringtype=unspecified
or using properties
spring.datasource.hikari.data-source-properties.stringtype=unspecified
You'll need to either use setObject
at the JDBC level, or pass the PgJDBC parameter stringtype=unspecified
to allow implicit casts from string types to json
etc.
It's a problem with PostgreSQL being too strict about type casting.