/** {@inheritDoc} */ @Override public void insert(Relay relay) { logger.debug("Inserting relay with id [{}]", relay.getId()); Map<String, Object> valuesToInsert = new HashMap<String, Object>(); valuesToInsert.put("id", relay.getId()); valuesToInsert.put("name", relay.getText()); jdbcInsert.execute(valuesToInsert); }
/** {@inheritDoc} */ @Override public void insertTranslation(Collection<Relay> relays) throws SQLException { List<Relay> relayList = new ArrayList(relays); List<Object[]> batch = new ArrayList<Object[]>(); for (Relay relay : relayList) { Object[] values = new Object[] {relay.getId(), relay.getLangId(), relay.getUnicodeText()}; batch.add(values); } jdbcTemplate.batchUpdate("insert into relaybylanguage values (?,?,?) ", batch); }
/** {@inheritDoc} */ @Override public void update(Relay relay) throws SQLException { logger.debug("Update relay with id [{}]", relay.getId()); jdbcTemplate.update( "update relaynames set Name=? where ID=?", new Object[] {relay.getText(), relay.getId()}); }