日期:2014-05-16  浏览次数:20482 次

jdbcTemplate查询及返回值方法
	private RowMapper amnyMapper = new RowMapper(){
		public Object mapRow(ResultSet r, int rowNum) throws java.sql.SQLException {
			AMNY   a = new  AMNY();
			a.setMny(r.getString("mny"));
			a.setMnyAffix(r.getString("mnyaffix"));
			a.setMnyName(r.getString("mnyname"));
			a.setMnyStyle(r.getInt("mnystyle"));
			return a;
		}
	};
	
	public  AMNY[]  getAmny(){
		String  sql = "select  a.mny,a.mnyname,a.mnyaffix,a.mnystyle  from  amny  a ";;
		List  list = jt.query(sql, amnyMapper);
		AMNY[]  a = new AMNY[list.size()];
		list.toArray(a);
		return a;
	}

?