salut à tous et à toutes.
dans mon application j'essais de selection un client à partir de son radical.
mais quand j'execute le programme il me donne l'exeption suivante:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
 
Exception in thread "main" org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [classes.Client_Physique#123456]
    at org.hibernate.impl.SessionFactoryImpl$1.handleEntityNotFound(SessionFactoryImpl.java:377)
    at org.hibernate.proxy.AbstractLazyInitializer.checkTargetState(AbstractLazyInitializer.java:79)
    at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:68)
    at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:111)
    at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:150)
    at classes.Client_Physique$$EnhancerByCGLIB$$d1581c71.getCin(<generated>)
    at test.main(test.java:14)
au debut j'ai cru que c'etait de la classe hibernateutil alors j'ai repris celle qui existe dans le tutoriel du site mais le probleme persisite
voila le code de ma classe client_physique
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
 
package classes;
 
public class Client_Physique {
 
    int radical;
    String cin,nom,prenom,adresse,ville,cde_pst,tel;
    public int getRadical() {
        return radical;
    }
    public void setRadical(int radical) {
        this.radical = radical;
    }
    public String getCin() {
        return cin;
    }
    public void setCin(String cin) {
        this.cin = cin;
    }
    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 getAdresse() {
        return adresse;
    }
    public void setAdresse(String adresse) {
        this.adresse = adresse;
    }
    public String getVille() {
        return ville;
    }
    public void setVille(String ville) {
        this.ville = ville;
    }
    public String getCde_pst() {
        return cde_pst;
    }
    public void setCde_pst(String cde_pst) {
        this.cde_pst = cde_pst;
    }
    public String getTel() {
        return tel;
    }
    public void setTel(String tel) {
        this.tel = tel;
    }
 
 
}
et voici le fichier du maping
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
 
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="classes">
<class name="Client_Physique" table="physique">
<id name="radical" column="radical" />
<property name="cin" type="string" column="cin"></property>
<property name="nom" type="string" column="nom"></property>
<property name="prenom" type="string" column="prenom"></property>
<property name="adresse" type="string" column="adresse"></property>
<property name="ville" type="string" column="ville"></property>
<property name="cde_pst" type="string" column="codepostal"></property>
<property name="tel" type="string" column="tel"></property>
</class>
</hibernate-mapping>
et pour que je sois clair ,j'ai au fait une autre classe client dont client_ophysique est une generalisation
voici son code et son fichier de mapping
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
 
package classes;
 
public class Client {
int radical,type;
 
public int getRadical() {
    return radical;
}
 
public void setRadical(int radical) {
    this.radical = radical;
}
 
public int getType() {
    return type;
}
 
public void setType(int type) {
    this.type = type;
}
 
}
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
 
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="classes">
<class name="Client" table="client">
<id name="radical" type="integer" column="radical" />
<property name="type" type="integer" column="type"></property>
</class>
</hibernate-mapping>
et merci d'avance je sais que mon poste est trop ennuieux mais vous m'exciserez car je suis allé trés loin dans le desespoire .