CoordinatesDao extends BaseDao { public List<DNCWorkCoordinate> getCoordinates() { SessionWrapper session = getCurrentSourceSession(); try { Query getCoordinates = session.getNamedQuery("getCoordinates"); List<DNCWorkCoordinate> coordinateList = getCoordinates .setResultTransformer(Transformers.aliasToBean(DNCWorkCoordinate.class)) .list(); return coordinateList; } catch (Exception ex) { logger.error("Error loading coordinates. Please check getCoordinates query. " + ex.getMessage()); return new ArrayList<>(); } finally { session.closeSession(); } }  List<DNCWorkCoordinate> getCoordinates();  }
@Test public void shouldLoadCoordinatesFromView() { dao.executeSQLQueryForSource("create table vwTestCoordinates(patientId int, sourceTable varchar(100), sourceColumn varchar(100), idInSourceTable int, pkColumnName varchar(100), type varchar(100), updateTime varchar(100))"); dao.executeSQLQueryForSource("insert into vwTestCoordinates values(5, 'patientDocuments', 'binaryData', 13, 'id', 'binary', '2015-10-10')"); List<DNCWorkCoordinate> result = dao.getCoordinates(); assertThat(result.size(), equalTo(1)); dao.executeSQLQueryForSource("drop table vwTestCoordinates"); }