如何在hibernate中执行hql语句,只查询部分字段得到的结果集也只有那一部分字段的属性,我试过select new Game(autoid,name,pinyin,initial,appkey,type) from Game
并且在对应的实体当中也创建了构造方法,DEBUG进去也确实是执行了
- public Game(Integer autoid, String name, String pinyin, String initial,
- String appkey, String type) {
-
- this.autoid = autoid;
- this.name = name;
- this.pinyin = pinyin;
- this.initial = initial;
- this.appkey = appkey;
- this.type = type;
- }
但是我最后的结果集,还是把其他那一堆的字段全带上了,只不过没赋值而已,怎样才能让他得到的结果集里没有别的乱七八糟的属性,只有我想要的字段的?