title: Map a JsonNode object to a String field in SQL DB JPA
body: <p>I got a Sql table with these fields:</p>
  <pre><code>id  uniqueidentifier primary key,
  &lt;--Omitting extra fields --&gt;
  metadata  nvarchar(max)
  </code></pre>
  <p>Which I also have a Entity mapped to it:</p>
  <pre><code>@Data
  public class GenericEntity implements Serializable {
  
    @Id
    @GeneratedValue(generator = &quot;uuid2&quot;)
    @GenericGenerator(name = &quot;uuid2&quot;, strategy = &quot;org.hibernate.id.UUIDGenerator&quot;)
    @Type(type = &quot;uuid-char&quot;)
    private UUID id;
  &lt;--Omitting extra properties --&gt;
    @Type(type = &quot;string&quot;)
    private JsonNode metadata;
  }
  </code></pre>
  <p>The second field that is a JsonNode needs to be able to accept different types of json and store it in the table as a String.</p>
  <p>How can I go about converting a JsonNode field and store it in the DB as a String then when I read from the table it converts the String back to a JsonNode?</p>
  <p>Payload:</p>
  <pre><code>{
      &quot;id&quot;: &quot;db8e8d4b-eee2-4507-bf30-f55c3f948724&quot;,
      &lt;-- Omitting extra properties --&gt;
      &quot;metadata&quot;: {
          &quot;description&quot;: &quot;Sample&quot;,
          &quot;location&quot;: &quot;Stack Overflow&quot;
      }
  }
  </code></pre>
  <p>Right now everytime I try to save it I get the error:</p>
  <pre><code>Could not determine type for: com.fasterxml.jackson.databind.JsonNode, at table: table_name, for columns: [org.hibernate.mapping.Column(metadata)]
  </code></pre>