Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-27250

(8.0.z) JPA/Hibernate: cannot write to a JSONB column

XMLWordPrintable

      I have a table in a postgresql database which is of type jsonb.

      I annotated the entity field with @org.hibernate.annotations.JdbcTypeCode(org.hibernate.type.SqlTypes.JSON)

      I was not able to insert a new entity (using a trivial persist) as hibernate complained loudly:

      org.hibernate.HibernateException: Could not find a FormatMapper for the JSON format, which is required for mapping JSON types. JSON FormatMapper configuration is automatic, but requires that you have either Jackson or a JSONB implementation like Yasson on the class path

      As a work-around, I added the following lines in org.hibernate module.xml:

      <module name="com.fasterxml.jackson.core.jackson-databind" optional="true" />
      <module name="com.fasterxml.jackson.core.jackson-core" optional="true" />

      I have zero confidence that my "fix" is correct, but "It Works (TM)" for this one application. Can you confirm that 1. the problem is legitimate and 2. the fix is OK ? I can carry the "patch" as long as needed.

              smarlow1@redhat.com Scott Marlow
              mverbert-iru Matthieu Verbert
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Created:
                Updated:
                Resolved: