ProcessLogDAO { public List<ProcessLogInfo> getProcessLog(ProcessLogInfo processLogInfo) { Session session = sessionFactory.openSession(); List<ProcessLogInfo> processLogInfoList = new ArrayList<ProcessLogInfo>(); try { session.beginTransaction(); Process process = (Process) session.get(Process.class, processLogInfo.getProcessId()); Integer counter = session.createCriteria(ProcessLog.class).add(Restrictions.eq(PROCESS, process)).list().size(); List<ProcessLog> processLogList = null; Criteria processLogListCriteria = session.createCriteria(ProcessLog.class).add(Restrictions.eq(PROCESS, process)); processLogList = processLogListCriteria.list(); Iterator iterator = processLogList.iterator(); while (iterator.hasNext()) { ProcessLog processLog = (ProcessLog) iterator.next(); ProcessLogInfo processLogInfo1 = new ProcessLogInfo(); processLogInfo1.setProcessId(processLog.getProcess().getProcessId()); processLogInfo1.setLogId(processLog.getLogId()); processLogInfo1.setAddTs(processLog.getAddTs()); processLogInfo1.setLogCategory(processLog.getLogCategory()); processLogInfo1.setMessage(processLog.getMessage()); processLogInfo1.setMessageId(processLog.getMessageId()); processLogInfo1.setInstanceRef(processLog.getInstanceRef()); processLogInfo1.setCounter(counter); processLogInfoList.add(processLogInfo1); } 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);  }
@Test @Ignore public void testGetProcessLog() { ProcessLogInfo processLogInfo = new ProcessLogInfo(); processLogInfo.setProcessId(5); processLogInfo.setLogCategory("test"); processLogInfo.setMessage("test"); processLogInfo.setMessageId("test"); processLogInfo.setInstanceRef(Long.parseLong("10")); processLogInfo.setAddTs(new Date()); List<ProcessLogInfo> processLogInfoList = processLogDAO.getProcessLog(processLogInfo); LOGGER.info("size of the list is " + processLogInfoList.size()); }