@Test public void addViewSpaceByNamedParams(){ ViewSpace space = new ViewSpace(); space.setSpaceName("鼓浪屿"); space.setAddress("厦门"); space.setDescription("厦门鼓浪屿"); viewSpaceDao.addViewSpaceByNamedParams(space); }
public void addViewSpaceByNamedParams(final ViewSpace viewSpace) { final String sql = "INSERT INTO t_view_space(space_name,description,address) VALUES(:spaceName,:description,:address)"; SqlParameterSource sps = new BeanPropertySqlParameterSource(viewSpace); namedParameterJdbcTemplate.update(sql, sps); }
ViewSpaceDao { public void addViewSpaceByNamedParams(final ViewSpace viewSpace) { final String sql = "INSERT INTO t_view_space(space_name,description,address) VALUES(:spaceName,:description,:address)"; SqlParameterSource sps = new BeanPropertySqlParameterSource(viewSpace); namedParameterJdbcTemplate.update(sql, sps); } }
ViewSpaceDao { public void addViewSpaceByNamedParams(final ViewSpace viewSpace) { final String sql = "INSERT INTO t_view_space(space_name,description,address) VALUES(:spaceName,:description,:address)"; SqlParameterSource sps = new BeanPropertySqlParameterSource(viewSpace); namedParameterJdbcTemplate.update(sql, sps); }  }
ViewSpaceDao { public void addViewSpaceByNamedParams(final ViewSpace viewSpace) { final String sql = "INSERT INTO t_view_space(space_name,description,address) VALUES(:spaceName,:description,:address)"; SqlParameterSource sps = new BeanPropertySqlParameterSource(viewSpace); namedParameterJdbcTemplate.update(sql, sps); }  void initDb(); void addViewSpace(final ViewSpace viewSpace); void addViewSpaceByNamedParams(final ViewSpace viewSpace); void addViewSpaces(final List<ViewSpace> viewSpaces); ViewSpace getViewSpace(final int spaceId); List<ViewSpace> getViewSpaces(final int fromId, final int toId); }
ViewSpaceDao { public void addViewSpaceByNamedParams(final ViewSpace viewSpace) { final String sql = "INSERT INTO t_view_space(space_name,description,address) VALUES(:spaceName,:description,:address)"; SqlParameterSource sps = new BeanPropertySqlParameterSource(viewSpace); namedParameterJdbcTemplate.update(sql, sps); }  void initDb(); void addViewSpace(final ViewSpace viewSpace); void addViewSpaceByNamedParams(final ViewSpace viewSpace); void addViewSpaces(final List<ViewSpace> viewSpaces); ViewSpace getViewSpace(final int spaceId); List<ViewSpace> getViewSpaces(final int fromId, final int toId);  }