google-code-export / nutz

Automatically exported from code.google.com/p/nutz
Apache License 2.0
1 stars 1 forks source link

userName为null #561

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
问题产生的条件:
  实体类对象中的成员变量存在大写,在用Record转换成POJO实体类对象时存在大写的成员变量取不到值。

发生问题的调用代码:
                Record re = dao.fetch("t_user", 
                Cnd.where("userName", "=", "feilongjian"));

        System.out.println("---------1、Record取得的值---------");
        //打印Record得到的值
        System.out.println(re.getInt("id"));
        System.out.println(re.getString("userName"));
        System.out.println(re.getString("password"));

        //把Record转换为POJO实体类User
        User user = re.toPojo(User.class);

        System.out.println("---------2、user取得的值---------");
        //打印user对象值
        System.out.println(user.getId());
        System.out.println(user.getUserName());
        System.out.println(user.getPassword());

        System.out.println("---------3、把Record转换成Json---------");
        System.out.println(re.toJson(JsonFormat.nice()));

问题的详细说明:
     在测试结果中:为什么Record转换为POJO对象后userName的值为空,难道不识别大小写?在实际开发项目中会经常遇到POJO类中的成员变量有大写的字母,怎么解决这个问题呢?

异常堆栈:

相关日志:

Original issue reported on code.google.com by zdsoftta...@gmail.com on 11 Sep 2012 at 1:28

Attachments:

GoogleCodeExporter commented 9 years ago
为什么你不用dao.fetch(User.class, Cnd.XXXX) 呢?

Original comment by wendal1985@gmail.com on 11 Sep 2012 at 1:44

GoogleCodeExporter commented 9 years ago
可以用啊,但是我看见文档里面提供了这种取值方式,所以��
�就试了一试咯,像遇到这种情况就不能由Record转换成POJO吗?

Original comment by zdsoftta...@gmail.com on 11 Sep 2012 at 1:53

GoogleCodeExporter commented 9 years ago

Original comment by wendal1985@gmail.com on 3 Dec 2012 at 9:59