DataQualityDAO { public List<com.wipro.ats.bdre.md.beans.table.Properties> listDQSetup(int startPage, int pageSize) { Session session = sessionFactory.openSession(); List<com.wipro.ats.bdre.md.beans.table.Properties> tablePropertiesList = new ArrayList<com.wipro.ats.bdre.md.beans.table.Properties>(); try { session.beginTransaction(); Criteria propertiesCriteria = session.createCriteria(Properties.class); propertiesCriteria.add(Restrictions.eq(CONFIGGROUP, "dq")); propertiesCriteria.setProjection(Projections.distinct(Projections.property("process"))); int counter = propertiesCriteria.list().size(); LOGGER.info("Distinct process id count: " + counter); Criteria listPropertiesCriteria = session.createCriteria(Properties.class); listPropertiesCriteria.add(Restrictions.eq(CONFIGGROUP, "dq")); listPropertiesCriteria.addOrder(Order.desc(PROCESSID)); listPropertiesCriteria.setFirstResult(startPage).setMaxResults(pageSize); List<Properties> propertiesList = listPropertiesCriteria.list(); Iterator<Properties> iterator = propertiesList.iterator(); while (iterator.hasNext()) { Properties properties = iterator.next(); com.wipro.ats.bdre.md.beans.table.Properties tableProperties = new com.wipro.ats.bdre.md.beans.table.Properties(); if (properties.getProcess() != null) tableProperties.setProcessId(properties.getProcess().getProcessId()); if (properties.getProcess() != null && properties.getProcess().getProcess() != null) tableProperties.setParentProcessId(properties.getProcess().getProcess().getProcessId()); tableProperties.setConfigGroup(properties.getConfigGroup()); if (properties.getId() != null) tableProperties.setKey(properties.getId().getPropKey()); tableProperties.setValue(properties.getPropValue()); tableProperties.setDescription(properties.getDescription()); tableProperties.setSubProcessId(properties.getProcess().getProcessId()); tableProperties.setCounter(counter); tablePropertiesList.add(tableProperties); } session.getTransaction().commit(); } catch (MetadataException e) { session.getTransaction().rollback(); LOGGER.error(e); } finally { session.close(); } return tablePropertiesList; }  void deleteDQSetup(int pid); List<com.wipro.ats.bdre.md.beans.table.Properties> listDQSetup(int startPage, int pageSize); List<com.wipro.ats.bdre.md.beans.table.Properties> insertDQSetup(DQSetupInfo dqSetupInfo,String username); List<com.wipro.ats.bdre.md.beans.table.Properties> updateDQSetup(DQSetupInfo dqSetupInfo);  }
@Ignore @Test public void listTest() { List<Properties> tableProperties = dataQualityDAO.listDQSetup(0, 10); for (Properties p : tableProperties) { LOGGER.info(p); } }