我正在使用MySQL和jpa / hibernate。
所以我想将列作为JPA中的Json数据类型,但不支持。
因此,我也不能在标准查询中使用。
哪种合适的方法来解决这个问题?
最佳答案
这对我有用
@Entity
@Table
@TypeDef(
name = "jsonb",
typeClass = JsonBinaryType.class
)
public class Blah{
//add your fields
@Type(type = "jsonb")
@Column(columnDefinition = "jsonb")
private String jsonField;
//add your getters and setters
}