FileDAO { public FileId insert(File file) { Session session = sessionFactory.openSession(); try { session.beginTransaction(); fileId = (FileId) session.save(file); session.getTransaction().commit(); } catch (MetadataException e) { session.getTransaction().rollback(); LOGGER.info(" Error Occured " + e); return null; } finally { session.close(); } return fileId; }  List<File> list(Integer pageNum, Integer numResults); Long totalRecordCount(); File get(FileId fileId); FileId insert(File file); com.wipro.ats.bdre.md.beans.table.File update(com.wipro.ats.bdre.md.beans.table.File tableFile); void delete(Long batchId); List<com.wipro.ats.bdre.md.beans.FileInfo> getFiles(long minBatchId, long maxBatchId); com.wipro.ats.bdre.md.beans.table.File getFile(com.wipro.ats.bdre.md.beans.table.File file); com.wipro.ats.bdre.md.beans.table.File insert(com.wipro.ats.bdre.md.beans.table.File tableFile);  }
@Test public void testInsert() { com.wipro.ats.bdre.md.beans.table.File file = new com.wipro.ats.bdre.md.beans.table.File(); file.setFileSize((long) 1); file.setCreationTS(new Date()); file.setBatchId((long) 0); file.setFileHash("test"); file.setPath("testPath"); file.setServerId(123461); com.wipro.ats.bdre.md.beans.table.File returnedFile = new com.wipro.ats.bdre.md.beans.table.File(); returnedFile = fileDAO.insert(file); fileDAO.delete(file.getBatchId()); }