I have a object array( it is an output of a native query in Oracle database) out of which the first element is of CLOB data type which needs to converted to a java String object. How would I achieve this? Please help.
String sql = "select id, data from mytable";
List< Object[] > results = getEntityManager().createNativeQuery(sql).getResultList();
Map< Long, String > map = new HashMap<>();
for (Object[] result : results) {
map.put(((Number) result[0]).longValue(), (String) result[1]);
}
data is a column in mydata table with CLOB data type. result(1) would have my CLOB data
While putting in the HashMap I need to parse the result(1) as String.