GetETLInfoDAO { public List<GetETLDriverInfo> getETLInfo(long minBatchId, long maxBatchId) { Session session = sessionFactory.openSession(); List<GetETLDriverInfo> getETLDriverInfoList = new ArrayList<GetETLDriverInfo>(); try { session.beginTransaction(); List<Batch> batchList = new ArrayList<Batch>(); List<File> fileList = new ArrayList<File>(); for (Long i = minBatchId; i <= maxBatchId; i++) { Batch batchSizeList = (Batch) session.get(Batch.class, i); if (batchSizeList != null) { batchList.add(batchSizeList); } } if (!batchList.isEmpty()) { Criteria FileCriteria = session.createCriteria(File.class).add(Restrictions.in("batch", batchList)); fileList = FileCriteria.list(); } for (File file : fileList) { GetETLDriverInfo getETLDriverInfo = new GetETLDriverInfo(); getETLDriverInfo.setFileList(file.getBatch().getBatchId() + "," + file.getServers().getServerId() + "," + file.getId().getPath() + "," +file.getId().getFileSize() + "," + file.getId().getFileHash() + "," + file.getId().getCreationTs()); getETLDriverInfoList.add(getETLDriverInfo); } session.getTransaction().commit(); return getETLDriverInfoList; } catch (MetadataException e) { session.getTransaction().rollback(); LOGGER.info("Error Occured " + e); return getETLDriverInfoList; } finally { session.close(); } }  List<GetETLDriverInfo> getETLInfo(long minBatchId, long maxBatchId);  }
@Ignore @Test public void testGetETLDriverInfos() throws Exception { List<GetETLDriverInfo> getETLDriverInfoList = getETLInfoDAO.getETLInfo(260, 260); LOGGER.info("Size of the list is " + getETLDriverInfoList.get(0).getFileList()); }