0

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.

rrr
  • 9
  • 3
  • Have you looked at this? https://stackoverflow.com/questions/15292331/sql-state-99999-error-code-17004-invalid-column-type-1111-with-spring-sim. Also, Oracle does not have a native JSON column type. It uses VARCHAR2 or CLOB with PL/SQL functions to parse JSON attributes in and out. – pmdba Jun 25 '20 at 03:21
  • yes, from google I understood - most of the articles mentions the potential error could be database column mismatch. I have defined it as varchar2(1000). What doesnt make sense is what should be proper datatype ? – rrr Jun 25 '20 at 03:28

0 Answers0