Invoke Method

ResultSet rs....
int index ...

Object obj = rs.getObject(index);
obj = rs.getTimestamp(index);
//this will throws exception "oracle.sql.TIMESTAMP cannot be cast to java.sql.Timestamp"

To solve this problem:


Class clz = obj.getClass();
Method method = clz.getMethod("timestampValue", null);
obj = (Timestamp) method.invoke(obj, null);