getHibernateTemplate().find(queryString) 返回的是什么对象?

String queryString = "from BClass";
   return getHibernateTemplate().find(queryString);

 

 

String queryString = "select cid as CODE , className as NAME from BClass";
   return getHibernateTemplate().find(queryString);

 

 

 

上面第一个返回的是包含BClass的List,那第二个的写法返回的是什么对象呢?

 

 

 


问题补充:
要怎么把它映射为haspmap呢?

hql多表查询

(1)String hql = "select new map(a.CUId as CUId,a.unitName as unitName,b.CUFId as CUFId,b.UFName as UFName) from PhCorrelativeUnit a,PhCorrelativeUnitFunction b where a.CUId=b.CUId";

List list = this.getHibernateTemplate().find(hql);

多个表的字段放到map中,map的键值就是as后面的别名,如果没有as就是字段名

(2) String hql = "select new com.phantom.appeal.action.bean.DealPaper(a.id as id,a.billId as billId,a.state as state,a.creator as creator,a.createtime as createtime ,b.eventContent as eventContent ,c.realName as realName,b.billCode as billCode,b.citName as citName ) from PhDealBill a,PhAcceptBill b,PhUser c where a.departmentId="+ billid+ " and a.state=0 and a.billId=b.billId and a.creator =c.userId order by a.billId";

return this.getHibernateTemplate().find(hql);

另外就是写一个类,对应你要查询的字段,这里的类名是new com.phantom.appeal.action.bean.DealPaper,里面对应查询的字段名

[url]http://spring028.iteye.com/blog/233669[/url]

数组
上面的as后面的内容基本上没作用,除非映射为map。
[url]http://huajiang.iteye.com/admin/blogs/473220[/url]