When selecting a count from a query result is there a better way than this? For example, I’m seeing Postgres return a Long and Oracle return a BigDecimal, so always casting to Long is no good.
Query q = new Query(). q.from(“mytable”); q.selectCount(); // SELECT COUNT(*) FROM “mytable”; … try (DataSet dataSet = dataContext.executeQuery(q)) { if (dataSet.next()) { Row r = dataSet.getRow(); for (SelectItem item : r.getSelectItems()) { Object N = r.getValue(item); if (N instanceof Number) { long count = ((Number)N).longValue()); } else { ... } } } } Thanks! db