Doing the following on the prompt returns one row:
asdf@dev:/home/asdf$db2 "select bo_id from (select h.bo_id, max(h.date) as latest from boh h join bo b on h.bo_id = b.id
where b.code = '625' AND h.status in ('A', 'B') group by h.bo_id) where latest < '2016-03-09'"
bo_id
1
1 record(s) selected.
But when doing the following java code it will return no rows:
String sql = "select bo_id from (select h.bo_id, max(h.date) as latest from boh h join bo b on h.bo_id = b.id where b.code = ? " +
"AND h.status in (?) group by h.bo_id) where latest < ?";
Query query = em.createNativeQuery(sql);
query.setParameter(1, "625");
query.setParameter(2, statusString);
query.setParameter(3, afterDate);
List<Long> branchOfferIds = query.getResultList();
The row List branchOfferIds = query.getResultList(); return no rows. I can not see what I am doing wrong. Could anybody please help out? I am running Linux , java 7 and db2 10.