I am working on a spring boot application where i need to insert data into teradata DB. My table consists of three columns : id, Name, Json_data where id and name are varchar, Json_data is JSON
我正在开发一个spring boot应用程序,我需要将数据插入到teradata DB中。我的表由三列组成:id,Name,Json_data,其中id和name是varchar,Json_data是JSON
i have a pojo class with id and name as String type and JSON_data as clob which is working perfectly to retrive the data (GET Operations)
我有一个pojo类,其id和名称为String类型,JSON_data为clob,完美地用于检索数据(GET操作)
I am getting the following error while inserting the data from postman
从邮递员插入数据时出现以下错误
2017-09-06 05:39:29.186 WARN 15516 --- [nio-9090-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Failed to read HTTP message: org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Can not construct instance of java.sql.Clob: abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of java.sql.Clob: abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information
at [Source: java.io.PushbackInputStream@1eee791; line: 9, column: 15] (through reference chain: com.model.SampleModel["jsondata"])
Can anyone explain which is the best way to insert the sample data from my rest API My JSON looks as below:
任何人都可以解释哪种是从我的其他API插入示例数据的最佳方式My JSON如下所示:
{
"id": "23",
"name": "Navatha",
"jsondata": "{\"Notes\": \"sample Note\",\"BU\": \"BFS\",\"NumberOfFields\": \"4\"}"
}
1 个解决方案
#1
0
Add the annotation Lob in your entity
在实体中添加注释Lob
@Lob
String jsondata
#1
0
Add the annotation Lob in your entity
在实体中添加注释Lob
@Lob
String jsondata