我发展的支柱2和应用程序的关联数组冬眠3.如何获取hibernate的查询结果列表或HashMap的
我有3个表
- 检验
- InspectionMission
- 时间轴
Inspection
与相关联0和InspectionMission
与Timeline
相关联。
现在我有以下问题。我在HQL
public List getQuartewiseInspectionList(){
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
Query q = session.createQuery(
"select count(i.inspectionId) as tot_inspections,t.year,t.quarter" +
" From Inspection as i " +
" inner join i.inspectionMission as im inner join im.timeline as t" +
" GROUP by t.year,t.quarter");
return q.list();
}
我想获取引起写下面的查询如下
result[0][tot_inspections] = "6"
result[0][year] = "2009";
result[0][quarter] = "Q2";
result[1][tot_inspections] = "3"
result[1][year] = "2009";
result[1][quarter] = "Q3";
等等,这样我可以在JSP支柱如下显示它:
在JSP中我写下面的代码
<table border="1">
<s:iterator value="result" status="status">
<tr class="<s:if test="#status.even">even</s:if><s:else>odd</s:else>">
<td class="nowrap"><s:property value="tot_inspections" /></td>
<td class="nowrap"><s:property value="year" /></td>
<td class="nowrap"><s:property value="quarter" /></td>
</tr>
</s:iterator>
</table>
任何人都可以帮助我吗?
Hello Salvatore Insalaco, 感谢您的回答。我正在寻找最后2天这个解决方案,你的答案提供给我。 感谢您的完美答案。 – amar4kintu 2009-05-29 12:14:18