/** * Loads the specified way from the database. * * @param userId * The unique identifier of the user. * @return The loaded user. */ public OsmUser getUser(long userId) { OsmUser user; try { user = jdbcTemplate.queryForObject(SELECT_USER, rowMapper, userId); } catch (EmptyResultDataAccessException e) { throw new NoSuchRecordException("User " + userId + " doesn't exist.", e); } return user; }
/** * Loads the specified entity from the database. * * @param entityId * The unique identifier of the entity. * @return The loaded entity. */ public T getEntity(long entityId) { T entity; try { entity = jdbcTemplate.queryForObject(entityMapper.getSqlSelect(true, false), entityMapper.getRowMapper(), entityId); } catch (EmptyResultDataAccessException e) { throw new NoSuchRecordException(entityMapper.getEntityName() + " " + entityId + " doesn't exist.", e); } return entity; }