I have application history id and I want to get the second highest history Id using criteria. Currently I can only get either lowest or highest value using code shown below.
criteria.addOrder(Order.desc("historyId"));
criteria.setMaxResults(1);
I would appreciate if anyone can direct me on how to get second highest value using hibernate criteria?
criteria.addOrder(Order.desc("historyId"));
criteria.setFirstResult(1);
criteria.setMaxResults(1);
This resolved the issue