List of usage examples for org.springframework.dao EmptyResultDataAccessException getMessage
@Override
@Nullable
public String getMessage()
From source file:org.sakaiproject.dash.dao.impl.DashboardDaoImpl.java
public Integer getConfigProperty(String propertyName) { if (log.isDebugEnabled()) { log.debug("getConfigProperty( " + propertyName + ")"); }//w ww. j a va 2 s. c om Integer value = null; String sql = getStatement("select.Config.by.propertyName"); Object[] params = new Object[] { propertyName }; JdbcTemplate jdbcTemplate = getJdbcTemplate(); try { value = jdbcTemplate.queryForInt(sql, params); } catch (EmptyResultDataAccessException ex) { // do nothing. This means no value is set for this property, an expected condition in some cases. // log.warn("getConfigProperty: Error executing query: " + ex.getClass() + ":" + ex.getMessage()); } catch (DataAccessException ex) { log.warn("getConfigProperty: Error executing query: " + ex.getClass() + ":" + ex.getMessage()); } catch (Exception ex) { log.warn("getConfigProperty: Error executing query: " + ex.getClass() + ":" + ex.getMessage()); } return value; }
From source file:org.sakaiproject.dash.dao.impl.DashboardDaoImpl.java
/** * construct HashMap, //from ww w . j av a2s . c om * keyed with context id, * value is set of user ids that has links(calendarlink, newslink) in dashboard * @param the sql name * @return HashMap object */ private HashMap<String, Set<String>> getDashboardContextUserMap(String sqlName) { HashMap<String, Set<String>> dashboardUserMap = new HashMap<String, Set<String>>(); String sql = getStatement(sqlName); try { List<String> contextUsersList = (List<String>) getJdbcTemplate().query(sql, new ContextUserMapper()); if (contextUsersList != null) { for (String contextUser : contextUsersList) { // the string returned from db query is of format context id + " " + user id // need to parse it out and form HashMap String[] parts = contextUser.split(" "); if (parts.length == 2) { // parts: context id (site id) and user id String context_id = parts[0]; String user_id = parts[1]; if (dashboardUserMap.containsKey(context_id)) { // get the current set and add user id into it Set<String> current = dashboardUserMap.get(context_id); current.add(user_id); dashboardUserMap.put(context_id, current); } else { // add the new key Set<String> current = new HashSet<String>(); current.add(user_id); dashboardUserMap.put(context_id, current); } } } } } catch (EmptyResultDataAccessException ex) { log.debug("getDashboardContextUserMap: Empty result executing query: " + sqlName + " " + ex.getClass() + ":" + ex.getMessage()); } catch (DataAccessException ex) { log.warn("getDashboardContextUserMap: Error executing query: " + sqlName + " " + ex.getClass() + ":" + ex.getMessage()); } return dashboardUserMap; }
From source file:wherehows.dao.table.DatasetsDao.java
/** * get WhereHows dataset URN by dataset ID * @param jdbcTemplate JdbcTemplate/*from ww w . jav a2s . c om*/ * @param datasetId int * @return URN String, if not found, return null */ public String getDatasetUrnById(JdbcTemplate jdbcTemplate, int datasetId) { try { return jdbcTemplate.queryForObject(GET_DATASET_URN_BY_ID, String.class, datasetId); } catch (EmptyResultDataAccessException e) { log.error("Can not find URN for dataset id: " + datasetId + " : " + e.getMessage()); } return null; }