@Test public void testAddForumByNamedParams() { Forum forum = new Forum(); forum.setForumName("2二手市场"); forum.setForumDesc("2二手货物的交流论坛。"); forumDao.addForumByNamedParams(forum); }
public void addForumByNamedParams(final Forum forum) { final String sql = "INSERT INTO t_forum(forum_name, forum_desc) VALUES(:forumName,:forumDesc)"; SqlParameterSource sps = new BeanPropertySqlParameterSource(forum); namedParameterJdbcTemplate.update(sql, sps); }
ForumDao { public void addForumByNamedParams(final Forum forum) { final String sql = "INSERT INTO t_forum(forum_name, forum_desc) VALUES(:forumName,:forumDesc)"; SqlParameterSource sps = new BeanPropertySqlParameterSource(forum); namedParameterJdbcTemplate.update(sql, sps); } }
ForumDao { public void addForumByNamedParams(final Forum forum) { final String sql = "INSERT INTO t_forum(forum_name, forum_desc) VALUES(:forumName,:forumDesc)"; SqlParameterSource sps = new BeanPropertySqlParameterSource(forum); namedParameterJdbcTemplate.update(sql, sps); }  }
ForumDao { public void addForumByNamedParams(final Forum forum) { final String sql = "INSERT INTO t_forum(forum_name, forum_desc) VALUES(:forumName,:forumDesc)"; SqlParameterSource sps = new BeanPropertySqlParameterSource(forum); namedParameterJdbcTemplate.update(sql, sps); }  @Autowired void setJdbcTemplate(JdbcTemplate jdbcTemplate); @Autowired void setNamedParameterJdbcTemplate(NamedParameterJdbcTemplate namedParameterJdbcTemplate); void initDb(); void addForum(final Forum forum); void addForumByNamedParams(final Forum forum); void addForums(final List<Forum> forums); Forum getForum(final int forumId); List<Forum> getForums(final int fromId, final int toId); }
ForumDao { public void addForumByNamedParams(final Forum forum) { final String sql = "INSERT INTO t_forum(forum_name, forum_desc) VALUES(:forumName,:forumDesc)"; SqlParameterSource sps = new BeanPropertySqlParameterSource(forum); namedParameterJdbcTemplate.update(sql, sps); }  @Autowired void setJdbcTemplate(JdbcTemplate jdbcTemplate); @Autowired void setNamedParameterJdbcTemplate(NamedParameterJdbcTemplate namedParameterJdbcTemplate); void initDb(); void addForum(final Forum forum); void addForumByNamedParams(final Forum forum); void addForums(final List<Forum> forums); Forum getForum(final int forumId); List<Forum> getForums(final int fromId, final int toId);  }