PropertiesTemplateDAO { public void deletePropertyTemplate(Integer processTemplateId, String key) { Session session = sessionFactory.openSession(); try { session.beginTransaction(); Criteria deletingCriteria = session.createCriteria(PropertiesTemplate.class).add(Restrictions.eq(PROCESSTEMPLATEID, processTemplateId)).add(Restrictions.eq(PROPTEMPKEY, key)); List<PropertiesTemplate> propertiesTemplateList = deletingCriteria.list(); for (PropertiesTemplate propertiesTemplate : propertiesTemplateList) { session.delete(propertiesTemplate); LOGGER.info("Config group of deleted Properties Template is" + propertiesTemplate.getConfigGroup()); } session.getTransaction().commit(); } catch (MetadataException e) { session.getTransaction().rollback(); LOGGER.error(e); } finally { session.close(); } }  List<com.wipro.ats.bdre.md.beans.table.PropertiesTemplate> listPropertiesTemplateBean(Integer processTemplateId); List<com.wipro.ats.bdre.md.beans.table.PropertiesTemplate> listPropertyTemplate(Integer pageNum, Integer numResults); List<PropertiesTemplate> list(Integer pageNum, Integer numResults); Long totalRecordCount(); PropertiesTemplate get(PropertiesTemplateId propertiesTemplateId); com.wipro.ats.bdre.md.beans.table.PropertiesTemplate insertProcessTemplate(com.wipro.ats.bdre.md.beans.table.PropertiesTemplate propertiesTemplate); PropertiesTemplateId insert(PropertiesTemplate propertiesTemplate); com.wipro.ats.bdre.md.beans.table.PropertiesTemplate updateProcessTemplate(com.wipro.ats.bdre.md.beans.table.PropertiesTemplate propertiesTemplate); void update(PropertiesTemplate propertiesTemplate); void deletePropertiesTemplate(Integer processTemplateId); void deletePropertyTemplate(Integer processTemplateId, String key); void delete(PropertiesTemplateId propertiesTemplateId);  }
@Test public void deletePropertyTemplateTest() throws Exception { int processTemplateId = 0; String key = "key test1234"; propertiesTemplateDAO.deletePropertyTemplate(processTemplateId, key); LOGGER.info("ProcessTemplateId of deleted Properties Template is" + processTemplateId); }