Bonjour,
J'ai 2 table:
doctor{id,email.....}
patient{numero,nom...}
et une table de jointure:
pivot{id, docor,patient}

voici les .java:
Doctor.java:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
 
...
private java.lang.String identifiant;
 
	private java.lang.String nom;
	private java.util.Date naissance;
	private java.lang.String specialite;
	.....
	private java.lang.String adresse;
 
	// collections
	private java.util.Set<Medical.Connection.Pivot> pivots;
...
Patient.java:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
 
private java.lang.String nom;
	private java.lang.String prenom;
	....
 
 
	// collections
 
	private java.util.Set<Medical.Connection.Pivot> pivots;
Pivot.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
 
 
public class Pivot {
	// primary key
		private java.lang.Integer id;
 
		// many to one
		private Medical.Connection.Patient pat;
		private Medical.Connection.Doctor numero;
 
 
 
		/**
                 * Return the unique identifier of this class
             * @hibernate.id
             *  generator-class="native"
             *  column="pid"
             */
		public java.lang.Integer getId () {
			return id;
		}
 
		/**
                 * Set the unique identifier of this class
                 * @param id the new ID
                 */
		public void setId (java.lang.Integer id) {
			this.id = id;
 
		}
 
 
 
 
		/**
                 * Return the value associated with the column: pat
                 */
		public Medical.Connection.Patient getPat () {
			return pat;
		}
 
		/**
                 * Set the value related to the column: pat
                 * @param pat the pat value
                 */
		public void setPat (Medical.Connection.Patient pat) {
			this.pat = pat;
		}
 
 
 
		/**
                 * Return the value associated with the column: numero
                 */
		public Medical.Connection.Doctor getNumero () {
			return numero;
		}
 
		/**
                 * Set the value related to the column: numero
                 * @param numero the numero value
                 */
		public void setNumero (Medical.Connection.Doctor numero) {
			this.numero = numero;
		}
 
 
 
 
		public boolean equals (Object obj) {
			if (null == obj) return false;
			if (!(obj instanceof Medical.Connection.Pivot)) return false;
			else {
				Medical.Connection.Pivot pivot = (Medical.Connection.Pivot) obj;
				if (null == this.getId() || null == pivot.getId()) return false;
				else return (this.getId().equals(pivot.getId()));
			}
		}
 
 
 
 
		public String toString () {
			return super.toString();
		}
 
 
	}
Je voudrai afficher les patients d'un docteur préci:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
 
 
public List listt(){
    	    	Session session = HibernateUtil.currentSession();
    	        session.beginTransaction();
    	        Query query = session.createQuery("from Patient ps  join ps.pivots as pv where pv.numero.id =1");
    	        query.setCacheable(true);
    	     List<Patient> result= query.list();
    	           session.getTransaction().commit();
 
 
    	        return result;
    	    }
1: le id d'un docteur précis.

Le query ne fonctionne pas bien sur
Aidez moi svp