ProcessLogDAO { public List<ProcessLogInfo> listLog(ProcessLogInfo processLogInfo) { Session session = sessionFactory.openSession(); session.beginTransaction(); List<ProcessLogInfo> processLogInfoList = new ArrayList<ProcessLogInfo>(); try { Criteria listProcessLogCriteria = session.createCriteria(ProcessLog.class).setProjection(Projections.distinct(Projections.property("process"))); int counter = listProcessLogCriteria.list().size(); LOGGER.info("number of distinct processid is " + counter); List<Process> processList = new ArrayList<Process>(); Criteria processLogListCriteria = session.createCriteria(ProcessLog.class).setProjection(Projections.distinct(Projections.property("process"))); processLogListCriteria.addOrder(Order.desc("process")).setFirstResult(processLogInfo.getPage()).setMaxResults(processLogInfo.getPageSize()); processList = processLogListCriteria.list(); LOGGER.info("size of processlog " + processList.size() + processList); Iterator<Process> iterator = processList.iterator(); while (iterator.hasNext()) { Process process = iterator.next(); ProcessLogInfo processLogInfo1 = new ProcessLogInfo(); processLogInfo1.setProcessId(process.getProcessId()); LOGGER.info("processid is " + process.getProcessId()); LOGGER.info("parentprocessid is " + process.getProcess()); if (process != null) processLogInfo1.setParentProcessId(process.getProcess().getProcessId()); else processLogInfo1.setParentProcessId(null); processLogInfo1.setCounter(counter); processLogInfoList.add(processLogInfo1); } LOGGER.info("processLogInfoList is "+processLogInfoList); session.getTransaction().commit(); } catch (MetadataException e) { session.getTransaction().rollback(); LOGGER.error(e); } finally { session.close(); } return processLogInfoList; }  List<ProcessLog> list(Integer pageNum, Integer numResults); Integer totalRecordCount(); ProcessLog get(Long id); Long insert(ProcessLog processLog); void update(ProcessLog processLog); void delete(Long id); void log(ProcessLogInfo processLogInfo); void logList(List<ProcessLogInfo> processLogInfoList); ProcessLogInfo getLastValue(ProcessLogInfo processLogInfo); List<ProcessLogInfo> listLog(ProcessLogInfo processLogInfo); List<ProcessLogInfo> getProcessLog(ProcessLogInfo processLogInfo); List<ProcessLogInfo> listLastInstanceRef(int processId, String messageId);  }
@Ignore @Test public void testlistLog() { ProcessLogInfo processLogInfo = new ProcessLogInfo(); processLogInfo.setParentProcessId(null); processLogInfo.setPage(0); processLogInfo.setPageSize(10); List<ProcessLogInfo> processLogInfoList = processLogDAO.listLog(processLogInfo); LOGGER.info("size of the list is " + processLogInfoList.size()); }