如果两个表没有关联影射通过HQL的JION会有 Path expected for join异常
解决方法:
String sql = "select {a.*}, {b.*} from a_table a left outer join b_table b on a.id = b.parentid";
Session session = getHibernateTemplate().getSessionFactory().openSession();
SQLQuery realQuery = session.createSQLQuery(sql);
//add entity
realQuery.addEntity("a", ABean.class);
realQuery.addEntity("b", BBean.class);
realQuery.addEntity("a", ABean.class);
realQuery.addEntity("b", BBean.class);
List dataList = realQuery.list();
返回的dataList为Object[]的list~