Hi everyone, I'm pretty new in Hibernate so I'm sorry if my question is trivial.
I got an action that does this:
Code:
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
List ordine = OrdiniManager.getInstance().list();
request.setAttribute("ordine", ordine);
return mapping.findForward("showNuoviOrdini");
}
It calls the metod list() of a class called OrdiniManager, that does this:
Code:
public List list() throws HibernateException
{
try {
SessionFactory sf = new Configuration().configure().buildSessionFactory();
Session session = sf.openSession();
Transaction tx = session.beginTransaction();
org.hibernate.Query q = session.createQuery("from Localita L inner join L.magazzinos M inner join M.ordineMagazzinos OM inner join OM.id.ordine O inner join O.cliente C where O.stato = 'in valutazione'");
List list=q.list();
tx.commit();
session.flush();
session.close();
sf.close();
return list;
}
catch (HibernateException e) {
e.printStackTrace();
return null;
}
}
I need to show the result of the query in a jsp page, but this won't work:
Code:
<logic:iterate id="ordine" name="ordine">
<tr class="riga_dati">
<td> </td>
<td>
<bean:write name="ordine" property="O.idOrdine" />
</td>
<td>
<bean:write name="ordine" property="C.idUtente" />
</td>
<td>
<bean:write name="ordine" format="dd/MM/yyyy HH:mm" property="O.dataRicezione" />
</td>
<td>
<bean:write name="ordine" format="dd/MM/yyyy" property="O.deadline" />
</td>
<td>
<bean:write name="ordine" property="M.idMagazzino" />
</td>
<td>
<bean:write name="ordine" property="O.priorita" />
</td>
</tr>
</logic:iterate>
I think the problem is that I can't manage a query using "inner joins" as a simple query. No exception is throwed.
How can I solve it?
Thank you!
Roberto from Italy