ProcessDAO { public List<Process> selectProcessList(Integer processId) { Session session = sessionFactory.openSession(); session.beginTransaction(); List<Process> processSubProcessList = new ArrayList<Process>(); try { Process parentProcess = (Process) session.get(Process.class, processId); Criteria checkProcessSubProcessList = session.createCriteria(Process.class).add(Restrictions.or(Restrictions.eq(PROCESSID, processId), Restrictions.eq(PROCESS, parentProcess))).add(Restrictions.eq(DELETE_FLAG, false)); processSubProcessList = checkProcessSubProcessList.list(); session.getTransaction().commit(); } catch (MetadataException e) { session.getTransaction().rollback(); LOGGER.error(e); } finally { session.close(); } return processSubProcessList; }  List<com.wipro.ats.bdre.md.dao.jpa.Process> list(Integer pid, Integer processTypeId,Integer pageNum, Integer numResults,String userName); List<com.wipro.ats.bdre.md.dao.jpa.Process> processList(); Integer totalRecordCount(Integer pid,Integer processTypeId); Integer totalCount(); Process get(Integer id); Process getParent(Integer id); Integer insert(Process process); Process update(Process process); void delete(Integer id); void testDelete(Integer id); List<com.wipro.ats.bdre.md.dao.jpa.Process> subProcesslist(Integer processId); String getParentProcessTypeId(Integer pid); String getProcessTypeName(Integer pid); List<Process> selectProcessList(Integer processId); List<Process> selectProcessList(String processCode,String username); Process returnProcess(String processCode,String username); List<Process> returnProcesses(String processCode); void updateProcessId(Integer oldProcessId, Integer newProcessId); Process cloneProcess(Integer processId); List<ProcessInfo> selectProcessListWithExec(Integer processId, Long instanceExecId); List<Process> createOneChildJob(Process parentProcess, Process childProcess, List<Properties> parentProps, List<Properties> childProps ); List<Process> createHiveMigrationJob(Process parentProcess, List<Process> childProcesses, List<Properties> parentProperties); List<Process> createAnalyticsAppJob(Process parentProcess, List<Process> childProcesses, List<Properties> appProperties); List<Process> createDataloadJob(Process parentProcess, List<Process> childProcesses, List<Properties> parentProps, Map<Process,List<Properties>> childProps ); String securityCheck(Integer processId,String username,String action); List<com.wipro.ats.bdre.md.dao.jpa.Process> listByName(String processName); List<Process> getDownStreamProcess(Integer pid);  }
@Test @Ignore public void testSelectProcessList() throws Exception { for(Process process: processDAO.selectProcessList(1)) { LOGGER.info("process "+process.getProcessId() + " is "+process.getProcessName()); } LOGGER.info("Total sub process along with parent process count is:" + processDAO.selectProcessList(1).size()); }