Bonjour tout le monde

je suis entrain de developper une application jsf/hibernate . et j'ai deux tables liées : etudiant et ecole
mon probléme est le suivant lors d'ajout d'un enregistrement
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 
javax.servlet.ServletException: /index.jsp(50,8) '#{etudiant.ecole.idEcole}' Target Unreachable, 'ecole' returned null
	javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
 
 
cause mère 
 
org.apache.jasper.el.JspPropertyNotFoundException: /index.jsp(50,8) '#{etudiant.ecole.idEcole}' Target Unreachable, 'ecole' returned null
	org.apache.jasper.el.JspValueExpression.getType(JspValueExpression.java:61)
	com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:81)
	javax.faces.component.UIInput.getConvertedValue(UIInput.java:934)
	javax.faces.component.UIInput.validate(UIInput.java:860)
	javax.faces.component.UIInput.executeValidate(UIInput.java:1065)
	javax.faces.component.UIInput.processValidators(UIInput.java:666)
	javax.faces.component.UIForm.processValidators(UIForm.java:229)
	javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1030)
	javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:662)
	com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:100)
	com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
	com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
	javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
code EtudiantBean.java
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
65
66
67
68
69
70
71
 
package beans;
 
import mapping.Ecole;
import mapping.Etudiant;
 
 
import org.hibernate.Session;
import org.hibernate.Transaction;
public class EtudiantBean {
 
private String id;
private String nom;
private String prenom;
private String f_id_ecole;
private Ecole ecole;
public String getId() {
	return id;
}
public void setId(String id) {
	this.id = id;
}
public String getNom() {
	return nom;
}
public void setNom(String nom) {
	this.nom = nom;
}
public String getPrenom() {
	return prenom;
}
public void setPrenom(String prenom) {
	this.prenom = prenom;
}
public String getF_id_ecole() {
	return f_id_ecole;
}
public void setF_id_ecole(String f_id_ecole) {
	this.f_id_ecole = f_id_ecole;
}
public Ecole getEcole() {
	return ecole;
}
public void setEcole(Ecole ecole) {
	this.ecole = ecole;
} 
public String inserer()
   {
 
 
		 Session session=mapping.HibernateSessionFactory.getSession();
         org.hibernate.Query query = session.createQuery("from Ecole as user where user.idEcole='"+f_id_ecole+"'");
         ecole = (Ecole)query.list().get(0);
 
         Transaction tx;
     	tx=session.beginTransaction();
     	 Etudiant V=new Etudiant();
         V.setId(id);
 
         V.setNom(nom);
         V.setPrenom(prenom);
 
        V.setEcole(ecole);
 
         session.save(V);
         tx.commit();
         return "ok";
 
 
    }
}
page index.jsp
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<base href="<%=basePath%>">
 
	<title>My JSF 'index.jsp' starting page</title>
 
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
 
</head>
 
<body>
	<f:view>
 
		<center>
 <h:form id="update">
 <h2>Pour ajouter un étudiant</h2>  
 
	<table>
	<tr>
	<td><h:outputText value="L'identifiant : " /></td>
	<td><h:inputText value="#{etudiant.id}" /></td>
	</tr>
   <tr>
   <td> <h:outputText value="  Nom   : " /></td>
  <td> <h:inputText value="#{etudiant.nom}" /></td>
    </tr>
    <tr>
    <td> <h:outputText value="Prénom: " /></td>
  <td>  <h:inputText value="#{etudiant.prenom}" /></td>
    </tr>
    <tr>
    <td><h:outputText value="  Ecole   : " /></td>
    <td><h:inputText value="#{etudiant.ecole.idEcole}" /></td>
     </tr>
     </table>
     <h:commandButton value="Ajouter" action="#{etudiant.inserer}" />
     </h:form>
     </center>
	</f:view>
</body>
</html>
aidez moi svp