/** {@inheritDoc} */ @Override public Collection<Relay> getAllWithTranslation() throws SQLException { String sqlQuery = "select * from relaynames " + "join relaybylanguage on relaynames.id=relaybylanguage.relayid " + "order by relaybylanguage.langid , relaybylanguage.relayid"; logger.debug("Get all relay names with translation to all languages "); return jdbcTemplate.query(sqlQuery, RowMappers.relay()); }
/** {@inheritDoc} */ @Override public Relay getById(Long id) throws SQLException { String sqlQuery = "select * from relaynames where ID=?"; List<Relay> relays = jdbcTemplate.query(sqlQuery, new Object[] {id}, RowMappers.relay()); if (relays.isEmpty()) { return null; } return relays.get(0); }
/** {@inheritDoc} */ @Override public Collection<Relay> getAll(Long langId) throws SQLException { String sqlQuery = "select r1.id, r1.name, r2.relayid, r2.langid, r2.unicodetext from relaynames r1 " + "left join relaybylanguage r2 on r1.id=r2.relayid and langid=" + langId; logger.debug("Get all relay names with given language id [{}] ", langId); return jdbcTemplate.query(sqlQuery, RowMappers.relay()); }
/** {@inheritDoc} */ @Override public Collection<Relay> getAll() throws SQLException { logger.debug("Get all relay names "); return jdbcTemplate.query("select * from relaynames order by id,name", RowMappers.relay()); }