I am trying to map a json column to jpa entity. However, I am getting below exception and couldn't figure out what's wrong with my code.
**
** ParentEntity:
@TypeDef(name = "json", typeClass = JsonStringType.class)
@Entity
@Table(name = "PARENT_TABLE")
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Parent implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@JsonProperty("uniqueValue")
private String uniqueValue;
@JsonProperty("child")
@Type(type = "json")
private Child child;
Child:
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"emails"
})
public class Child implements Serializable {
@JsonProperty("emails")
private List<Email> emails = null;
private final static long serialVersionUID = 798012776653999527L;
}
Error:
2020-06-24 23:51:11.165 WARN 3688 --- [io-11106-exec-1] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 17004, SQLState: 99999
2020-06-24 23:51:11.166 ERROR 3688 --- [io-11106-exec-1] o.h.engine.jdbc.spi.SqlExceptionHelper : Invalid column type: 1111
I have tried multiple approaches, however not successful in persisting to database. Thanks in advance.