I have in my Entity
class a field which is a CLOB
type which represents a column in my Oracle
. database. I want to write into this field a object from this class:
class Person{
String firstName;
String lastName;
Integer age;
// getters, setters, constructors
}
Something like this:
Person personObject = new Person();
Clob myClob = saveAsClob(personObject);
// save it into Oracle DB
How to achieve something like this? Convert my object into JSONObject
and then save it as String
? Or maybe is there any other way?