* hql中的字段都是属性,表是类名
* String hql = select new map(tA.t1,tA.t2,tB.f1,tB.f2) from TableA tA,TableB tB where tA.id = tB.tid;
* List<Map<String, Object>> basicList = getHibernateTemplate().find(hql);
*
* 或者sql查询
* 【使用as是为了取别名。如果字段名和别名一致,就没有必要使用as了】
* String sql = "select tA.t1 as t1,tA.t2 as t2,tB.f1 as f1,tB.f2 as f2 from tableA tA,tableB tB where tA.id = tB.tid";
* Session session = this.getHibernateTemplate().getSessionFactory().openSession();
* List<Map<String, Object>> basicList = session.createSQLQuery(sql).setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).list();
* if(session!=null && session.isOpen())session.close();//在finally中关闭
*
* 得到如下结果集
* t1 t2 f1 f2
* table1 table2 A D
* table1 table2 B E
* table1 table2 C F
* table3 table4 O X
* table3 table4 P Y
* table3 table4 Q Z
*/