框架技术--spring JdbcTempalte 执行存储过程

	public Map<String, String> push(final PushBean pb) throws Exception {
		StringBuffer sql = new StringBuffer();
		sql.append("{call adUmwPush_mac(?,?,?,?,?,?,?,?,?,?,?)}");
		Map<String, String> map = new HashMap<String, String>();
		map = jdbcTemplateUAS.execute(sql.toString(),
				new CallableStatementCallback<Map<String, String>>() {
					public Map<String, String> doInCallableStatement(
							final CallableStatement cs) throws SQLException,
							DataAccessException {
						cs.setInt(1, pb.getUid());
						cs.setInt(2, pb.getAdid());
						cs.setInt(3, pb.getTemp());
						cs.setString(4, pb.getMac());
						cs.setString(5, pb.getUrl());
						cs.setString(6, pb.getHurlaction());
						cs.setString(7, pb.getAdcontentType());
						cs.setString(8, pb.getStartime());
						cs.setString(9, pb.getEnd());
						cs.registerOutParameter(10, java.sql.Types.INTEGER);
						cs.registerOutParameter(11, java.sql.Types.INTEGER);
						cs.execute();
						Map<String, String> map = new HashMap<String, String>();
						map.put("RESULT", cs.getString(10));
						map.put("F_PRICE", cs.getString(11));
						return map;
					}
				});
		return map;
	}


参考:http://blog.csdn.net/hu_shengyang/article/details/7896782

你可能感兴趣的:(spring,JdbcTempalte)