I am POJO having Clob type variable. I am converting POJO type json to the POJO type Java Object using GSON library. But unable to convert. It's giving error like Unable to invoke no-args constructor for interface java.sql.Clob
My POJO Class
import java.sql.Clob;
public class MyPojo {
private String name;
private Clob message;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Clob getMessage() {
return message;
}
public void setMessage(Clob message) {
this.message = message;
}
}
Conversion class
import java.text.ParseException;
import org.json.JSONException;
import com.google.gson.Gson;
public class SaveClobType {
public static void main(String[] args) throws ParseException, JSONException {
Gson gson = new Gson();
String jsonString = "{\"name\" : \"Country\", \"message\" : \"Hello country\"}";
MyPojo obj = gson.fromJson(jsonString, MyPojo.class);
System.out.println("Object converted successfully");
}
}
Please anyone can help me for this. Thanks!