现在的位置: 首页 > 综合 > 正文

多表查询时,返回的数据分配:

2013年11月11日 ⁄ 综合 ⁄ 共 360字 ⁄ 字号 评论关闭

多表查询时,返回的数据分配:
比如:hql = " from table1 a,table2 b " +" where a.year = :year and a.empId in " + employeeIds  Where +" and a.version = :version and a.empId = b.id and a.status in" + statusWhere;
这是对两个表的查询返回的是两个表的数据,分配时如下
for (int i = 0; i < pbscList.size(); i++) {
Object[] objects = (Object[]) pbscList.get(i);
TPbscbook pbscBook = (TPbscbook) objects[0];
Employee emp = (Employee) objects[1];

返回的集合中每条数据都包含两个表中的数据,所以在分成数组。

抱歉!评论已关闭.