Bind content_json as JSON, or every insert fails

Fixkamo-shared-library
Shipped
September 3, 2026 at 12:20 AM UTC
Author
Kamo
Commit
5bee52c

REPORTED: "Failed to create sales script". The server said exactly why: column "content_json" is of type jsonb but expression is of type character varying columnDefinition = "JSONB" decides only what DDL Hibernate GENERATES. It says nothing about how a value is BOUND, so the String was still sent as varchar and PostgreSQL will not implicitly cast varchar to jsonb. KbArticle.contentJson — which stores the same Lexical documents and works — carries BOTH the column definition and @JdbcTypeCode(SqlTypes.JSON). I copied the first line and not the second. Nothing in the build could have caught it. The column is created correctly, the entity compiles, and SalesScriptServiceTest passes because it mocks the repository; the failure needs a real database to appear at all. So JsonbBindingTest now asserts the pairing by reflection over every @Entity in the library: a String field on a json/jsonb column with no @JdbcTypeCode is a build failure. Verified non-vacuous — with the annotation removed it names SalesScriptBlock.contentJson and fails; with it restored it passes. It also reports that no OTHER entity currently has this defect, so this was the only occurrence rather than the first of many. No DDL change: the column is already jsonb and always was. Only the binding was wrong.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing