code: public static <T> List<T> queryForList(String sql, Class<T> clz, Object... args) {
  		List<T> result = new ArrayList<T>();
  		Connection con = null;
  		PreparedStatement ps = null;
  		ResultSet rs = null;
  		try {
  			con = getconnnection();
  			ps = con.prepareStatement(sql);
  			if (args != null) {
  				for (int i = 0; i < args.length; i++) {
  					ps.setObject((i + 1), args[i]);
  				}
  			}
  			rs = ps.executeQuery();
  			ResultSetMetaData rsmd = rs.getMetaData();
  			int columnCount = rsmd.getColumnCount();
  			while (rs.next()) {
  				T obj = clz.newInstance();
  				for (int i = 1; i <= columnCount; i++) {
  					String columnName = rsmd.getColumnName(i);
  					String methodName = "set" + columnName.substring(0, 1).toUpperCase()
  							+ columnName.substring(1, columnName.length());
  					Method method[] = clz.getMethods();
  					for (Method meth : method) {
  						if (methodName.equals(meth.getName())) {
  							meth.invoke(obj, rs.getObject(i));
  						}
  					}
  				}
  				result.add(obj);
  			}
  		} catch (InstantiationException e) {
  			e.printStackTrace();
  		} catch (IllegalAccessException e) {
  			e.printStackTrace();
  		} catch (SQLException e) {
  			e.printStackTrace();
  		} catch (IllegalArgumentException e) {
  			e.printStackTrace();
  		} catch (InvocationTargetException e) {
  			e.printStackTrace();
  		} finally {
  			close(rs, ps, con);
  		}
  		return result;
  	}
docs: Query a single record
  
  @param sql
  @param args
  @return List<T>