I execute a native query by JPA. My DB is oracle and I have a Clob column. When I get the result, How can I get the clob value from the resultList? I cast it to String and I get ClassCastException. actual object is com.sun.proxy.$Proxy86.
Query query = entityManager.createNativeQuery("Select Value from Condition");
List<Object[]> objectArray = query.getResultList();
for (Object[] object : objectArray) {
???
}
You can use java.sql.Clob
for (Object[] object : objectArray) {
Clob clob = (Clob)object[0];
String value = clob.getSubString(1, (int) clob.length());
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With