@Test public void shouldSaveAnonymisedTextToTargetDB() { dao.executeSQLQueryForTarget("create table TBLTESTOUTPUTCOORDINATE (SOURCETABLE varchar(100), SOURCECOLUMN varchar(100), IDINSOURCETABLE int, PROCESSEDTEXT varchar(100), UPDATETIME varchar(100))"); DNCWorkCoordinate coordinate = new DNCWorkCoordinate().sourceTable("TBLTESTOUTPUTCOORDINATE") .sourceColumn("someBinaryColumn").idInSourceTable(4L); coordinate.setUpdateTime("2015-02-11 16:18:43.42"); dao.saveConvertedText(coordinate, "anonymised text"); List list = dao.getSQLResultFromTarget("select processedText from TBLTESTOUTPUTCOORDINATE where IDINSOURCETABLE=4"); String text = (String) list.get(0); assertThat(text, equalTo("anonymised text")); dao.executeSQLQueryForTarget("DROP TABLE TBLTESTOUTPUTCOORDINATE"); }
public void saveConvertedText(DNCWorkCoordinate coordinate, String processedText) { SessionWrapper sessionWrapper = getCurrentTargetSession(); try { Query query = sessionWrapper.getNamedQuery("saveTextToCoordinate"); String queryString = query.getQueryString(); SQLQuery sqlQuery = sessionWrapper.createSQLQuery(queryString); sqlQuery.setParameter(0, coordinate.getSourceTable()); sqlQuery.setParameter(1, coordinate.getSourceColumn()); sqlQuery.setParameter(2, coordinate.getIdInSourceTable()); sqlQuery.setParameter(3, processedText); sqlQuery.executeUpdate(); } finally { sessionWrapper.closeSession(); } }
DNCWorkUnitDao extends BaseDao { public void saveConvertedText(DNCWorkCoordinate coordinate, String processedText) { SessionWrapper sessionWrapper = getCurrentTargetSession(); try { Query query = sessionWrapper.getNamedQuery("saveTextToCoordinate"); String queryString = query.getQueryString(); SQLQuery sqlQuery = sessionWrapper.createSQLQuery(queryString); sqlQuery.setParameter(0, coordinate.getSourceTable()); sqlQuery.setParameter(1, coordinate.getSourceColumn()); sqlQuery.setParameter(2, coordinate.getIdInSourceTable()); sqlQuery.setParameter(3, processedText); sqlQuery.executeUpdate(); } finally { sessionWrapper.closeSession(); } } }
DNCWorkUnitDao extends BaseDao { public void saveConvertedText(DNCWorkCoordinate coordinate, String processedText) { SessionWrapper sessionWrapper = getCurrentTargetSession(); try { Query query = sessionWrapper.getNamedQuery("saveTextToCoordinate"); String queryString = query.getQueryString(); SQLQuery sqlQuery = sessionWrapper.createSQLQuery(queryString); sqlQuery.setParameter(0, coordinate.getSourceTable()); sqlQuery.setParameter(1, coordinate.getSourceColumn()); sqlQuery.setParameter(2, coordinate.getIdInSourceTable()); sqlQuery.setParameter(3, processedText); sqlQuery.executeUpdate(); } finally { sessionWrapper.closeSession(); } }  }
DNCWorkUnitDao extends BaseDao { public void saveConvertedText(DNCWorkCoordinate coordinate, String processedText) { SessionWrapper sessionWrapper = getCurrentTargetSession(); try { Query query = sessionWrapper.getNamedQuery("saveTextToCoordinate"); String queryString = query.getQueryString(); SQLQuery sqlQuery = sessionWrapper.createSQLQuery(queryString); sqlQuery.setParameter(0, coordinate.getSourceTable()); sqlQuery.setParameter(1, coordinate.getSourceColumn()); sqlQuery.setParameter(2, coordinate.getIdInSourceTable()); sqlQuery.setParameter(3, processedText); sqlQuery.executeUpdate(); } finally { sessionWrapper.closeSession(); } }  String getTextFromCoordinate(DNCWorkCoordinate coordinate); byte[] getByteFromCoordinate(DNCWorkCoordinate coordinate); void saveConvertedText(DNCWorkCoordinate coordinate, String processedText); }
DNCWorkUnitDao extends BaseDao { public void saveConvertedText(DNCWorkCoordinate coordinate, String processedText) { SessionWrapper sessionWrapper = getCurrentTargetSession(); try { Query query = sessionWrapper.getNamedQuery("saveTextToCoordinate"); String queryString = query.getQueryString(); SQLQuery sqlQuery = sessionWrapper.createSQLQuery(queryString); sqlQuery.setParameter(0, coordinate.getSourceTable()); sqlQuery.setParameter(1, coordinate.getSourceColumn()); sqlQuery.setParameter(2, coordinate.getIdInSourceTable()); sqlQuery.setParameter(3, processedText); sqlQuery.executeUpdate(); } finally { sessionWrapper.closeSession(); } }  String getTextFromCoordinate(DNCWorkCoordinate coordinate); byte[] getByteFromCoordinate(DNCWorkCoordinate coordinate); void saveConvertedText(DNCWorkCoordinate coordinate, String processedText);  }