I have an oracle table MYTABLE
which has 3 columns as mentioned below.
|id | myclob_column | column3|
It has one column (myclob_column
) which is clob data (json). Sample clob data is below.
{
"id" : 10001
"name" : "Rahul",
"keyvalue" : [ {"key" : "100", "value" : "A"}, {"key" : "200", "value" : "B"} .....]
}
KeyValue is defined as a class in my project like below.
@Data
public class KeyValue {
private String key;
private String value;
}
I am using org.hibernate.annotations.Formula
annotations on name
& keyvalue
field.
@Data
@Entity
@Table(name = "MYTABLE")
public class MyEntity {
@Id
private String id;
@Formula("JSON_VALUE(myclob_column, '$.name')")
private String name;
@Formula("JSON_VALUE(myclob_column, '$.keyvalue[*]')")
private List<KeyValue> keyvalue;
}
While running the Spring Boot
application, I am getting error for keyvalue
field and application is not getting started for this.
org.hibernate.MappingException: Could not determine type for: java.util.List, at table: MYTABLE, for columns: [org.hibernate.mapping.Formula(JSON_VALUE(myclob_column, '$.keyvalue[*]'))]
Can you please suggest what is the issue.
Database - Oracle, Hibernate Version - 5.6