@Test public void testGetUserTopicNum() throws Throwable { int num = topicDao.getUserTopicNum(1); System.out.println("num is:" + num); }
public int getUserTopicNum(final int userId) { String sql = "{call P_GET_TOPIC_NUM(?,?)}"; CallableStatementCreatorFactory fac = new CallableStatementCreatorFactory(sql); fac.addParameter(new SqlParameter("userId",Types.INTEGER)); fac.addParameter(new SqlOutParameter("topicNum",Types.INTEGER)); Map<String,Integer> paramsMap = new HashMap<String,Integer>(); paramsMap.put("userId",userId); CallableStatementCreator csc = fac.newCallableStatementCreator (paramsMap); Integer num = jdbcTemplate.execute(csc,new CallableStatementCallback<Integer>(){ public Integer doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException { cs.execute(); return cs.getInt(2); } }); return num; }
TopicDao { public int getUserTopicNum(final int userId) { String sql = "{call P_GET_TOPIC_NUM(?,?)}"; CallableStatementCreatorFactory fac = new CallableStatementCreatorFactory(sql); fac.addParameter(new SqlParameter("userId",Types.INTEGER)); fac.addParameter(new SqlOutParameter("topicNum",Types.INTEGER)); Map<String,Integer> paramsMap = new HashMap<String,Integer>(); paramsMap.put("userId",userId); CallableStatementCreator csc = fac.newCallableStatementCreator (paramsMap); Integer num = jdbcTemplate.execute(csc,new CallableStatementCallback<Integer>(){ public Integer doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException { cs.execute(); return cs.getInt(2); } }); return num; } }
TopicDao { public int getUserTopicNum(final int userId) { String sql = "{call P_GET_TOPIC_NUM(?,?)}"; CallableStatementCreatorFactory fac = new CallableStatementCreatorFactory(sql); fac.addParameter(new SqlParameter("userId",Types.INTEGER)); fac.addParameter(new SqlOutParameter("topicNum",Types.INTEGER)); Map<String,Integer> paramsMap = new HashMap<String,Integer>(); paramsMap.put("userId",userId); CallableStatementCreator csc = fac.newCallableStatementCreator (paramsMap); Integer num = jdbcTemplate.execute(csc,new CallableStatementCallback<Integer>(){ public Integer doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException { cs.execute(); return cs.getInt(2); } }); return num; }  }
TopicDao { public int getUserTopicNum(final int userId) { String sql = "{call P_GET_TOPIC_NUM(?,?)}"; CallableStatementCreatorFactory fac = new CallableStatementCreatorFactory(sql); fac.addParameter(new SqlParameter("userId",Types.INTEGER)); fac.addParameter(new SqlOutParameter("topicNum",Types.INTEGER)); Map<String,Integer> paramsMap = new HashMap<String,Integer>(); paramsMap.put("userId",userId); CallableStatementCreator csc = fac.newCallableStatementCreator (paramsMap); Integer num = jdbcTemplate.execute(csc,new CallableStatementCallback<Integer>(){ public Integer doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException { cs.execute(); return cs.getInt(2); } }); return num; }  @Autowired void setJdbcTemplate(JdbcTemplate jdbcTemplate); double getReplyRate(int userId); int getUserTopicNum(final int userId); int getUserTopicNum2(int userId); SqlRowSet getTopicRowSet(int userId); }
TopicDao { public int getUserTopicNum(final int userId) { String sql = "{call P_GET_TOPIC_NUM(?,?)}"; CallableStatementCreatorFactory fac = new CallableStatementCreatorFactory(sql); fac.addParameter(new SqlParameter("userId",Types.INTEGER)); fac.addParameter(new SqlOutParameter("topicNum",Types.INTEGER)); Map<String,Integer> paramsMap = new HashMap<String,Integer>(); paramsMap.put("userId",userId); CallableStatementCreator csc = fac.newCallableStatementCreator (paramsMap); Integer num = jdbcTemplate.execute(csc,new CallableStatementCallback<Integer>(){ public Integer doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException { cs.execute(); return cs.getInt(2); } }); return num; }  @Autowired void setJdbcTemplate(JdbcTemplate jdbcTemplate); double getReplyRate(int userId); int getUserTopicNum(final int userId); int getUserTopicNum2(int userId); SqlRowSet getTopicRowSet(int userId);  }