Posted on 2013-03-01 00:04
朱杰兵 阅读(4956)
评论(1) 编辑 收藏
1>返回map
String sql="****";
Query query = this.getSession().createSQLQuery(sql.toString());
query.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);
List list=query.list();
2>返回list
String sql="****";
Query query = this.getSession().createSQLQuery(sql.toString());
query.setResultTransformer(Transformers.TO_LIST);
List list=query.list();
注意:Query query = session.createSQLQuery(sql);
List list=query.list(); 返回的是object数组