IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Hibernate Java Discussion :

No row with the given identifier exists


Sujet :

Hibernate Java

  1. #1
    Membre éclairé Avatar de thaundeadboss
    Homme Profil pro
    Développeur COBOL & JAVA
    Inscrit en
    Février 2007
    Messages
    211
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : Maroc

    Informations professionnelles :
    Activité : Développeur COBOL & JAVA
    Secteur : Finance

    Informations forums :
    Inscription : Février 2007
    Messages : 211
    Par défaut No row with the given identifier exists
    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 .

  2. #2
    Membre confirmé
    Profil pro
    Sr. Software Engineer
    Inscrit en
    Août 2007
    Messages
    169
    Détails du profil
    Informations personnelles :
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Sr. Software Engineer

    Informations forums :
    Inscription : Août 2007
    Messages : 169
    Par défaut
    L'exception remontée est pourtant assez précise. hibernate essaie d'accéder à un objet dont l'id n'existe pas. vérifie dans la bd que cet objet existe réellement.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [Hibernate] No row with the given identifier exists
    Par Battosaiii dans le forum Hibernate
    Réponses: 1
    Dernier message: 23/05/2011, 11h38
  2. No row with the given identifier exists
    Par *alexandre* dans le forum Hibernate
    Réponses: 0
    Dernier message: 14/10/2008, 14h35
  3. Réponses: 1
    Dernier message: 30/06/2008, 17h29
  4. Réponses: 2
    Dernier message: 27/07/2007, 09h21

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo