Map parameter = new HashMap(); parameter.put("table", "sales2009"); parameter.put("date", "2009-10-08"); //MySQL date :) parameter.put("product_id",17); SqlMapClient sqlMap = (SqlMapClient) getServletContext().getAttribute("sqlMap"); List result = sqlMap.queryForList("selectSalesByParameters",parameter); for(Sales s : result) { }
@SuppressWarnings("unchecked") public Collection<Object> lookup(String id, Object ... parameters) { try { return sqlMapClient.queryForList(id, parameters); } catch (SQLException e) { throw new DaoException("Exception throw while executing query with statement id '" + id + "' and parameters '" + parameters + "'", e); } }
@SuppressWarnings("unchecked") public Collection<Object> lookup(String id, Object ... parameters) { try { return sqlMapClient.queryForList(id, parameters); } catch (SQLException e) { throw new DaoException("Exception throw while executing query with statement id '" + id + "' and parameters '" + parameters + "'", e); } }
@SuppressWarnings("unchecked") public Collection<Object> lookup(String id, Map<String, ?> parameters) { try { return sqlMapClient.queryForList(id, parameters); } catch (SQLException e) { throw new DaoException("Exception throw while executing query with statement id '" + id + "' and parameters '" + parameters + "'", e); } }
@SuppressWarnings("unchecked") public Collection<Object> lookup(String id, Map<String, ?> parameters) { try { return sqlMapClient.queryForList(id, parameters); } catch (SQLException e) { throw new DaoException("Exception throw while executing query with statement id '" + id + "' and parameters '" + parameters + "'", e); } }
/** * Execute a database request to get a list of object identifiers. This request * must be a very simple and efficient request because it will get all the requested * identifiers. * @return Map of all entries names that are returned by the directory with an associated map of * attribute names and values (never null) */ @SuppressWarnings("unchecked") public Map<String, LscDatasets> getListPivots() { /* TODO: This is a bit of a hack - we use ListOrderedMap to keep order of the list returned, * since it may be important when coming from a database. * This is really an API bug, getListPivots() should return a List, not a Map. */ Map<String, LscDatasets> ret = new ListOrderedMap(); try { List<HashMap<String, Object>> ids = (List<HashMap<String, Object>>) sqlMapper.queryForList(getRequestNameForList()); Iterator<HashMap<String, Object>> idsIter = ids.iterator(); Map<String, Object> idMap; for (int count = 1; idsIter.hasNext(); count++) { idMap = idsIter.next(); ret.put(getMapKey(idMap, count), new LscDatasets(idMap)); } } catch (SQLException e) { LOGGER.warn("Error while looking for the entries list: {}", e.toString()); LOGGER.debug(e.toString(), e); } return ret; }
try { srcBean = beanClass.newInstance(); List<?> records = sqlMapper.queryForList(getRequestNameForObjectOrClean(fromSameService), getAttributesMap(attributes)); if(records.size() > 1) { throw new LscServiceException("Only a single record can be returned from a getObject request ! " +