code: public static <T> SqlParamsPairs getGetFromObject(Class<T> clazz,Object id) throws NoIdAnnotationFoundException, NoColumnAnnotationFoundException{
  		
  		//用来存放get语句
  		StringBuffer getSql = new StringBuffer();
  		
  		//分析表名
  		String tableName = getTableName(clazz);
  		
  		getSql.append("select * from " + tableName + " where ");
  		
  		//分析列
  		Field[] fields = clazz.getDeclaredFields();
  		Id idAnno = null;
  		for (int i = 0; i < fields.length; i++) {
  			Field f = fields[i];
  			
  			//找id字段
  			Method getter = getGetter(clazz,f);
  			
  			if(getter == null){
  				//没有get方法直接跳过
  				continue;
  			}
  			
  			//看是不是主键
  			idAnno = getter.getAnnotation(Id.class);
  			if(idAnno == null){
  				continue;
  			}
  			
  			//get column name
  			String columnName = getColumnNameFromGetter(getter,f);
  
  			getSql.append(columnName + " = ?");
  			
  			break;
  		}
  		
  		//全部遍历完如果找不到主键就抛异常
  		if(idAnno == null){
  			throw new NoIdAnnotationFoundException(clazz);
  		}
  		
  		SqlParamsPairs sqlAndParams = new SqlParamsPairs(getSql.toString(),new Object[]{id});
  		logger.debug(sqlAndParams.toString());
  		
  		return sqlAndParams;
  	}
docs: 获取根据主键查对象的sql和参数
  @param id
  @return
  @throws NoIdAnnotationFoundException
  @throws NoColumnAnnotationFoundException
  @throws NoDefinedGetterException
  @throws
  @throws Exception