Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-19262

hibernate.type.json_format_mapper error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 32.0.0.Final
    • 17.0.1.Final
    • JPA / Hibernate
    • None
    • Hide

      persistence.xml

      I'm trying to set a json_format_mapper because 
      <persistence>

      <persistence-unit ...>

      ...

      <properties>

      <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>

      <property name="hibernate.type.json_format_mapper" value="jsonb"/>

      </properties>

      </persistence-unit>

      </persistence>

       
      ENTITY

      @Entity

      public class Example

      implements ExampleSql, Serializable

      {

      private static final long serialVersionUID = 2946203422351859351L;

       

      private long id;

      private JsonValue jsonSchema;

       

      @Id

      @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = Id_Seq)

      @SequenceGenerator(name = Id_Seq, sequenceName = Id_Seq, allocationSize = 1)

      @Column(name = Column_Id)

      public long getId()

      {

      return id;

      }

       

      public void setId(long id)

      {

      this.id = id;

      }

       

      @JdbcTypeCode(SqlTypes.JSON)

      @Column(name = Column_JsonSchema, nullable = false, columnDefinition = "jsonb")

      public JsonValue getJsonSchema()

      {

      return jsonSchema;

      }

      public void setJsonSchema(JsonValue jsonSchema)

      {

      this.jsonSchema = jsonSchema;

      }

      {color:#000000}}

      Show
      persistence.xml I'm trying to set a json_format_mapper because  < persistence > <persistence-unit ...> ... < properties > < property name = "hibernate.dialect" value = "org.hibernate.dialect.PostgreSQLDialect" /> < property name = "hibernate.type.json_format_mapper" value = "jsonb" /> </ properties > </ persistence-unit > </ persistence >   ENTITY @Entity public class Example implements ExampleSql, Serializable { private static final long serialVersionUID = 2946203422351859351L;   private long id; private JsonValue jsonSchema ;   @Id @GeneratedValue (strategy = GenerationType. SEQUENCE , generator = Id_Seq ) @SequenceGenerator (name = Id_Seq , sequenceName = Id_Seq , allocationSize = 1) @Column (name = Column_Id ) public long getId() { return id ; }   public void setId( long id ) { this . id = id ; }   @JdbcTypeCode(SqlTypes.JSON) @Column (name = Column_JsonSchema , nullable = false , columnDefinition = " jsonb " ) public JsonValue getJsonSchema() { return jsonSchema ; } public void setJsonSchema(JsonValue jsonSchema ) { this . jsonSchema = jsonSchema ; } {color:#000000}}
    • ---
    • ---

      When attempting to use a JSON field that I want to leave as free-form JSON rather than immediately converting to a POJO or I get a ClassNotFoundException in the Wildfly hibernate module while deploying.

      I'm annotating my json field like this:

      @JdbcTypeCode(SqlTypes.JSON)

      @Column(name = Column_JsonSchema, nullable = false, columnDefinition = "jsonb")

      This is when I set the hibernate.type.json_format_mapper property to either jackson or jsonb as per https://docs.jboss.org/hibernate/orm/6.1/userguide/html_single/Hibernate_User_Guide.html#misc-options.

       

      Deployment of my EAR fails in this scenario:

      For hibernate.type.json_format_mapper=jackson:

      • Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.core.JsonProcessingException from [Module "org.hibernate" version 6.1.5.Final from local module loader @40238dd0 (finder: local module finder
        @7776ab (roots: B:\wildfly\wildfly-27.0.1.Final\modules,B:\wildfly\wildfly-27.0.1.Final\modules\system\layers\base))]

      For hibernate.type.json_format_mapper=jsonb:

      • Caused by: java.lang.ClassNotFoundException: jakarta.json.bind.JsonbException from [Module "org.hibernate" version 6.1.5.Final from local module loader @40238dd0 (finder: local module finder @7776ab (roots: B:\wildfly\wildfly-27.0.1.Final\modules,B:\wildfly\wildfly-27.0.1.Final\modules\system\layers\base))]

              smarlow1@redhat.com Scott Marlow
              vbn_cio Patrick Bakker (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: