title: How to automatically serialize and deserialize JSON string using JPA and Hibernate?
body: <p>I have data class/table "User" that has column "preferences"</p>
  
  <pre><code>CREATE table "user"; 
  ALTER TABLE "user" ADD COLUMN preferences TEXT;
  </code></pre>
  
  <p>Preferences type is TEXT and I am storing JSON there.</p>
  
  <pre><code>public class User extends AbstractEntity{
  public String preferences;
  }
  </code></pre>
  
  <p>so <code>user.preferences</code> value is <code>"{notifyByEmail:1, favouriteColor:"blue" }"</code></p>
  
  <p>How can I wrap it with some annotation so I can access it like</p>
  
  <pre><code>user.preferences.notifyByEmail
  </code></pre>
  
  <p>or without need to wrap into data object</p>
  
  <pre><code>user.preferences.get("notifByEmail");
  user.preferences.set("notifByEmail",true);
  </code></pre>
  
  <p>I imagine there could be some Jackson annotation that I can add to field
  like</p>
  
  <pre><code>@JsonGenerate
  public String preferences;
  </code></pre>
  
  <p>I am fairly new to JPA and documentation is steep. </p>
  
  <p>I believe my case is quite common. Can anyone give any examples?</p>