problème avec le composant <rich:datatable> et une requete hql
dans mon application web sous netbeans j'ai besoin d'afficher le contenu de ma table Ao qui est en relation many to one avec la table modepassation tant que je n'inclus pas la table mode de passation ca marche mais dès que je veux afficher aussi pour chaqu eao son nom de mode de passation ca marche pas
voila afficherAo.jsp
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
| <%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<f:view>
<h:form>
<rich:dataTable value="#{AomBean.listeAo}" var="ao" rows="25" binding="#{AomBean.matable}"rowClasses= "row1,row2" headerClass="heading">
<rich:column filterBy="#{ao.reference}" filterEvent="onkeyup" style="width:10%">
<f:facet name="header" >
<h:outputText value="reference" /></f:facet>
<h:outputText value="#{ao.reference}"/>
</rich:column>
<rich:column filterBy="#{ao.objet}" filterEvent="onkeyup" >
<f:facet name="header" >
<h:outputText value="objet" /></f:facet>
<h:outputText value="#{ao.objet}"/>
</rich:column>
<rich:column filterBy="#{ao.dateOuverture}" filterEvent="onkeyup" >
<f:facet name="header" >
<h:outputText value="date ouverture" /></f:facet>
<h:outputText value="#{ao.dateOuverture}"/>
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputText value="nombre de lots"/>
</f:facet>
<h:outputText value="#{ao.nombreLots}"/>
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputText value="mode de passation"/>
</f:facet>
<h:outputText value="#{ao.nomMode}"/>
</rich:column>
</rich:dataTable>
</h:form>
</f:view>
</body>
</html> |
et la fonction getListeAo qui strouve dans l'AoBean
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| public List getListeAo()
{
List users = new ArrayList();
try {
org.hibernate.Session session = NewHibernateUtil.currentSession();
org.hibernate.Query q = session.createQuery("from Ao a, ModePassation m where a.idMode=m.idMode");
users = q.list();
} catch (Exception e) {
e.printStackTrace();
}
return users;
} |
il est à noter que le AomBean est le managed bean de la classe AoBean je pense que j'ai un probleme avec la requete SQL dans la fonction getListeAo()
car dès que je la modifie par : from Ao
ca maffiche parfaitement le contenu
mon but est d'afficher tout le contenu de la bd Ao et en plus d'afficher pour chaque Ao le nom de son mode passation.donc j'ai une autre table modePassation qui contient l' idMode et nomMode.Vraiment je bloque à ce niveau car ça ne marche pas
svp aidez moi:cry: