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