How to create jaxb Object to Clob. When i tried the following not serializable error coming.
public static void createClob(TestTo testTo){
PreparedStatement pst = null;
Connection con = null;
//Clob studentListClob = null;
try {
con = openOASDBcon(false);
pst = con.prepareCall(INSERT_Clob);
pst.setBytes(1, getByteArrayObject(testTo));
pst.setString(2, "");
pst.executeUpdate();
} catch (Exception e) {
e.printStackTrace();
} finally {
close(con, pst);
}
}
private static byte[] getByteArrayObject(TestTo testTo){
byte[] byteArrayObject = null;
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(testTo);
oos.close();
bos.close();
byteArrayObject = bos.toByteArray();
} catch (Exception e) {
e.printStackTrace();
return byteArrayObject;
}
return byteArrayObject;
}
It's not possible to implement serializable. Is there any best way to implement jaxb object to clob.