I have this propery in my entity class:
@Column(name="avatar",nullable=false,length=1000)
String getAvatarData() {
return new JSONObject(avatar.export()).toString();
}
void setAvatarData(String data) {
avatar = Avatar.restore(new JSONObject(data).toMap());
}
Hibernate doesn’t handle it at all. At least, it’s not included in the schema it generates.
on your entity. That’s JPA 2.0. For 1.0, use
org.hibernate.AccessType:By the way, I would rather have a simple field with getters and setters, and annotate the field instead. Then, if you want custom transformations, add other methods, like
getFooAsJSON