ProcessDAO { public Integer totalRecordCount(Integer pid,Integer processTypeId) { Session session = sessionFactory.openSession(); Integer size = 0; try { session.beginTransaction(); Process argument = new Process(); Process process = new Process(); if (pid != null) { argument.setProcessId(pid); process = (Process) session.get(Process.class, pid); } Criteria checkSubProcessCriteria = session.createCriteria(Process.class).add(Restrictions.eq(PROCESS, argument)).add(Restrictions.eq(DELETE_FLAG, false)); if (pid == null) { if(processTypeId==null) { Criteria criteria = session.createCriteria(Process.class).add(Restrictions.isNull(PARENTPROCESSID)).add(Restrictions.eq(DELETE_FLAG, false)).add(Restrictions.not(Restrictions.eq("processType.processTypeId",41))); size = criteria.list().size(); } else { Criteria criteria = session.createCriteria(Process.class).add(Restrictions.isNull(PARENTPROCESSID)).add(Restrictions.eq(DELETE_FLAG, false)).add(Restrictions.eq("processType.processTypeId",processTypeId)); size = criteria.list().size(); } } else if (checkSubProcessCriteria.list().isEmpty() && process.getProcessId() == pid) { Criteria listOfRelatedSP = session.createCriteria(Process.class).add(Restrictions.eq(PROCESSID, process.getProcess().getProcessId())).add(Restrictions.eq(DELETE_FLAG, false)) .addOrder(Order.desc(PROCESSID)); size = listOfRelatedSP.list().size(); } else { Criteria processList = session.createCriteria(Process.class).add(Restrictions.isNull(PARENTPROCESSID)).add(Restrictions.eq(PROCESSID, pid)) .add(Restrictions.eq(DELETE_FLAG, false)); LOGGER.info("size of pro is " + processList.list().size()); size = processList.list().size(); } session.getTransaction().commit(); } catch (MetadataException e) { session.getTransaction().rollback(); LOGGER.error(e); } finally { session.close(); } return size; }  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 testTotalRecordCount() throws Exception { }