List of usage examples for org.springframework.jdbc.core.namedparam MapSqlParameterSource MapSqlParameterSource
public MapSqlParameterSource()
From source file:annis.administration.AbstractAdminstrationDao.java
protected MapSqlParameterSource makeArgs() { return new MapSqlParameterSource(); }
From source file:org.voltdb.example.springjdbc.ContestantDao.java
public List<ContestantData> getAllContestants() { MapSqlParameterSource params = new MapSqlParameterSource(); return query(getAllSql, params, new ContestantRowMapper()); }
From source file:com.devicehive.dao.rdbms.DeviceDaoRdbmsImpl.java
/** * Method return a Map where KEY is a device guid from guids list and * VALUE is OfflineTimeout from deviceClass for device with current guid. * * @param guids list of guids// ww w. jav a2 s . c om */ public Map<String, Integer> getOfflineTimeForDevices(List<String> guids) { final Map<String, Integer> deviceInfo = new HashMap<>(); MapSqlParameterSource parameters = new MapSqlParameterSource(); parameters.addValue("guids", guids); List<Map<String, Object>> results = jdbcTemplate.queryForList(GET_DEVICES_GUIDS_AND_OFFLINE_TIMEOUT, parameters); results.stream() .forEach(map -> deviceInfo.put((String) map.get("guid"), (Integer) map.get("offline_timeout"))); return deviceInfo; }
From source file:org.inbio.modeling.core.dao.impl.LayerDAOImpl.java
@Override public void update(Layer updatedLayer) { String createStatement = null; MapSqlParameterSource args = null;//from w ww . j ava2 s .co m createStatement = "UPDATE " + this.table + " " + " SET name = :name, " + " display_name = :display_name, " + " description = :description, " + " uri = :uri, " + " source = :source, " + " year = :year, " + " data_scale = :data_scale, " + " visualization_scale = :viz_scale, " + " last_update = :last_update, " + " generation_procedure = :generation_procedure, " + " is_species_map= :is_species_map " + " WHERE id = :layer_id"; args = new MapSqlParameterSource(); args.addValue("name", updatedLayer.getName()); args.addValue("display_name", updatedLayer.getDisplayName()); args.addValue("uri", updatedLayer.getUri()); args.addValue("source", updatedLayer.getSource()); args.addValue("year", updatedLayer.getYear()); args.addValue("viz_scale", updatedLayer.getVizScale()); args.addValue("data_scale", updatedLayer.getDataScale()); args.addValue("generation_procedure", updatedLayer.getGenerationProcedure()); args.addValue("last_update", Calendar.getInstance().getTime()); args.addValue("description", updatedLayer.getDescription()); args.addValue("is_species_map", updatedLayer.isSpeciesMap()); args.addValue("layer_id", updatedLayer.getId()); getSimpleJdbcTemplate().update(createStatement, args); }
From source file:tomekkup.helenos.dao.ClusterConfigDao.java
public void store(ClusterConfiguration configuration) { if (configuration.isActive()) { jdbcTemplate.update(queriesProperties.getProperty("clusterconfig.update.all.active.false"), new MapSqlParameterSource()); }/*from www . ja v a2 s. c om*/ jdbcTemplate.update(queriesProperties.getProperty("clusterconfig.merge"), prepareParameterSource(configuration)); }
From source file:com.github.dbourdette.glass.log.joblog.jdbc.JdbcJobLogStore.java
@Override public Page<JobLog> getLogs(Long executionId, Query query) { String sql = "from " + configuration.getTablePrefix() + "log where executionId = :executionId"; SqlParameterSource source = new MapSqlParameterSource().addValue("executionId", executionId); return getLogs(sql, source, query); }
From source file:com.daugherty.e2c.persistence.data.jdbc.JdbcSupplierDao.java
@Override public Supplier loadLatest(Long id, Locale locale) { LOGGER.debug("Looking up latest supplier with ID " + id); String sql = getSql("supplier/loadLatest.sql"); SqlParameterSource parameterSource = new MapSqlParameterSource().addValue("partyId", id) .addValue(SqlQueryCriteria.LANGUAGE_PARAMETER_NAME, locale.getLanguage()); Supplier supplier = null;// w w w . java2 s . co m try { supplier = jdbcTemplate.query(sql, parameterSource, new SupplierResultSetExtractor()).get(0); } catch (IndexOutOfBoundsException e) { throw new EmptyResultDataAccessException(1); } return supplier; }
From source file:org.voltdb.example.springjdbc.ContestantDao.java
public int deleteAllContestants() { MapSqlParameterSource params = new MapSqlParameterSource(); return update(deleteAll, params); }
From source file:com.github.dbourdette.glass.log.execution.jdbc.JdbcJobExecutions.java
@Override public void jobEnds(JobExecution execution, JobExecutionContext context) { String sql = "update " + getTableName() + " set endDate = :endDate, ended = :ended, result = :result where id = :id"; SqlParameterSource params = new MapSqlParameterSource() .addValue("endDate", new DateTime(context.getFireTime()).plusMillis((int) context.getJobRunTime()).toDate()) .addValue("ended", true).addValue("result", execution.getResult().name()) .addValue("id", execution.getId()); jdbcTemplate.update(sql, params);/*ww w. j a v a 2s . c om*/ }
From source file:com.joliciel.jochre.boundaries.BoundaryDaoJdbc.java
@Override public List<Split> findSplits(Shape shape) { NamedParameterJdbcTemplate jt = new NamedParameterJdbcTemplate(this.getDataSource()); String sql = "SELECT " + SELECT_SPLIT + " FROM ocr_split WHERE split_shape_id=:split_shape_id" + " ORDER BY split_position"; MapSqlParameterSource paramSource = new MapSqlParameterSource(); paramSource.addValue("split_shape_id", shape.getId()); LOG.debug(sql);/*w w w. j a va2 s . co m*/ logParameters(paramSource); @SuppressWarnings("unchecked") List<Split> splits = jt.query(sql, paramSource, new SplitMapper(this.getBoundaryServiceInternal())); return splits; }