Please Help How Can I add .addOrder(Order.desc("CaseNo,"of", CaseYear ")); I have two Tables Case_Master and Event_Master.
CaseId is foreign key in event_master . I am fetching eventmasterlist from criteria query. I wanted just to sort by Casenumber which is present in casemaster.(CaseNumber 1 of 2011) order should be like this 1 of 2011 ,2of 2011,3 of 2011, 4 of 2011,5 of 2011 Criteria crt = session.createCriteria(merc.dao.EventMasterDao.class).add(Restrictions.eq("isDeleted", "N")).addOrder(Order.asc("eventDate")); fetchList = (ArrayList<EventMasterDao>) crt.list();
Criteria crt = sess.createCriteria(merc.dao.CaseMasterDao.class).add(Restrictions.eq("isDeleted", "N")) .addOrder(Order.desc("caseId")) .addOrder(Order.asc("caseNo")) .addOrder(Order.asc("caseYear")); fetchList = (ArrayList<CaseMasterDao>) crt.list();
Last edited by asimshaikh1Hib on Thu Dec 04, 2014 2:04 am, edited 1 time in total.
|