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 :

[Hibernate] Retourner tous les infos d'une instances d'une base


Sujet :

Hibernate Java

  1. #1
    Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2015
    Messages
    5
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Janvier 2015
    Messages : 5
    Points : 4
    Points
    4
    Par défaut [Hibernate] Retourner tous les infos d'une instances d'une base
    Bonjour,

    J'ai dans ma base de données une table Client avec beaucoup de colonne Id, adresse... J'utilise le modèle MVC pour le développement avec le Hibernate et les PrimeFaces pour la vue.

    J'aimerais parvenir à retourner dans un form, avec des inputtext PrimeFaces, toutes les informations propres à un client donné et selon la saisie de son id dans un inputtext, puis à l'aide d'un bouton Rechercher.

    Je suis arrivé à retourner juste une une seule information de la table Client et voilà tous les codes nécessaires :

    La méthode de recherche dans la classe ClientDao:
    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
    public List findByCriteria(Class clazz, Criterion critere) { 
    List objects = null; 
    try { 
    openCurrentSessionwithTransaction(); 
    Criteria crit = currentSession.createCriteria(clazz).add(critere); 
    objects = crit.list(); 
    } catch (Exception e) { 
    e.printStackTrace(); 
    ; 
    } finally { 
    currentSession.close(); 
    } 
    return objects; 
     
    }
    La methode de recherche dans la classe ClientController:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    public void ChercherContact() { 
    try { 
    Client clt = new Client(); 
    System.out.println("id " + idSociete); 
    Criterion critere = Restrictions.eq("idSociete", 
    client.getIdSociete()); 
    List<Client> l = ClientDao.findByCriteria(Client.class, critere); 
    clt = l.get(0); 
    } catch (Exception e) { 
    e.printStackTrace(); 
    }
    La page modifier.xhtml qui est ma vue:
    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
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:ui="http://java.sun.com/jsf/facelets" 
    xmlns:f="http://java.sun.com/jsf/core" 
    xmlns:h="http://java.sun.com/jsf/html" 
    xmlns:p="http://primefaces.org/ui"> 
     
     
    <h:form id="f"> 
    <h:panelGrid columns="1" style="margin: 0 auto"> 
    <p:graphicImage value="ooredoo.jpg" 
    style="height : 204px; width : 590px; margin: 0 auto " /> 
     
    </h:panelGrid> 
    <h:panelGrid columns="4" style="margin: 0 auto"> 
    <h:outputText value="ID CLIENT:" 
    style="FONT-SIZE: large; COLOR: #ff0000; FONT-WEIGHT: bold;" /> 
     
    <p:inputText value="#{clientCtr.client.idSociete}" id="id_societe" 
    style="background-color:White;font-weight:bold;border-width:medium;border-color:Red;border-style:solid;"> 
    </p:inputText> 
    <p:commandButton action="#{clientCtr.ChercherContact}" 
    update="f" value="CHERCHER" 
    style="background-color:Red;color:White;font-weight: bold;font-size:  large;border-color:Black;float:center;border-style:outset; width :  176px;"> 
    </p:commandButton> 
    <p:commandButton id="quitter" value="QUITTER" action="e" 
    onclick="window.close()" 
    style="background-color:Red;color:White;font-weight: bold;font-size:  large;border-color:Black;float:center;border-style:outset; width :  176px;"> 
    </p:commandButton> 
    </h:panelGrid> 
    <h:panelGrid columns="2" style="margin: 0 auto" id="grid"> 
    <h:outputText value="Nom De La Société:" 
    style="FONT-SIZE: large; COLOR: #ff0000; FONT-WEIGHT: bold;" /> 
    <p:inputText value="#{clientCtr.client.nomSociete}" id="nom_societe" 
    style="background-color:White;font-weight:  bold;border-width:medium;border-color:Red;border-style:solid;"></p:inputText>  
     
    <h:outputText value="ID De La Société:" 
    style="FONT-SIZE: large; COLOR: #ff0000; FONT-WEIGHT: bold;" /> 
    <p:inputText value="#{clientCtr.client.idSociete}" id="id_societes" 
    style="background-color:White;font-weight:  bold;border-width:medium;border-color:Red;border-style:solid;"></p:inputText>  
    <h:outputText value="Route:" 
    style="FONT-SIZE: large; COLOR: #ff0000; FONT-WEIGHT: bold;" /> 
    <p:inputText value="#{clientCtr.client.route}" id="route" 
    style="background-color:White;font-weight:  bold;border-width:medium;border-color:Red;border-style:solid;"></p:inputText>  
    <h:outputText value="NCGR:" 
    style="FONT-SIZE: large; COLOR: #ff0000; FONT-WEIGHT: bold;" /> 
    <p:inputText value="#{clientCtr.client.ncgr}" id="ncgr" 
    style="background-color:White;font-weight:  bold;border-width:medium;border-color:Red;border-style:solid;"></p:inputText>  
    <h:outputText value="FQDN:" 
    style="FONT-SIZE: large; COLOR: #ff0000; FONT-WEIGHT: bold;" /> 
    <p:inputText value="#{clientCtr.client.fqdn}" id="fqdn" 
    style="background-color:White;font-weight:  bold;border-width:medium;border-color:Red;border-style:solid;"></p:inputText>  
    <h:outputText value="RTGRP:" 
    style="FONT-SIZE: large; COLOR: #ff0000; FONT-WEIGHT: bold;" /> 
    <p:inputText value="#{clientCtr.client.rtgrp}" id="rtgrp" 
    style="background-color:White;font-weight:  bold;border-width:medium;border-color:Red;border-style:solid;"></p:inputText>  
    <h:outputText value="OUTBPROXY:" 
    style="FONT-SIZE: large; COLOR: #ff0000; FONT-WEIGHT: bold;" /> 
    <p:inputText value="#{clientCtr.client.outbproxy}" id="outbproxy" 
    style="background-color:White;font-weight:  bold;border-width:medium;border-color:Red;border-style:solid;"></p:inputText>  
    <h:outputText value="Directory Number:" 
    style="FONT-SIZE: large; COLOR: #ff0000; FONT-WEIGHT: bold;" /> 
    <p:inputText value="#{clientCtr.client.directoryNumber}" 
    id="directory_number" 
    style="background-color:White;font-weight:  bold;border-width:medium;border-color:Red;border-style:solid;"></p:inputText>  
    <h:outputText value="NDEST:" 
    style="FONT-SIZE: large; COLOR: #ff0000; FONT-WEIGHT: bold;" /> 
    <p:inputText value="#{clientCtr.client.ndest}" id="ndest" 
    style="background-color:White;font-weight:  bold;border-width:medium;border-color:Red;border-style:solid;"></p:inputText>  
    <h:outputText value="Operator Number:" 
    style="FONT-SIZE: large; COLOR: #ff0000; FONT-WEIGHT: bold;" /> 
    <p:inputText value="#{clientCtr.client.operatorNumber}" 
    id="operateur_number" 
    style="background-color:White;font-weight:  bold;border-width:medium;border-color:Red;border-style:solid;"></p:inputText>  
    <h:outputText value="Additional DN :" 
    style="FONT-SIZE: large; COLOR: #ff0000; FONT-WEIGHT: bold;" /> 
    <h:selectOneListbox value="additional_dn" 
    style="background-color:White;font-weight:bold;border-color:Red;border-border-style:solid; width : 169px; " /> 
     
    <h:outputText value="SCRI:" 
    style="FONT-SIZE: large; COLOR: #ff0000; FONT-WEIGHT: bold;" /> 
    <p:inputText value="#{clientCtr.client.scri}" id="scri" 
    style="background-color:White;font-weight:  bold;border-width:medium;border-color:Red;border-style:solid;"></p:inputText>  
     
    <h:outputText value="UPDI:" 
    style="FONT-SIZE: large; COLOR: #ff0000; FONT-WEIGHT: bold;" /> 
    <p:inputText value="#{clientCtr.client.upd}" id="updi" 
    style="background-color:White;font-weight:  bold;border-width:medium;border-color:Red;border-style:solid;"></p:inputText>  
    </h:panelGrid> 
    <h:panelGrid columns="2" style="margin: 0 auto"> 
     
     
    <p:commandButton id="quittere" value="QUITTER" action="e" 
    onclick="window.close()" 
    style="background-color:Red;color:White;font-weight: bold;font-size:  large;border-color:Black;float:center;border-style:outset; width :  176px;" /> 
     
    </h:panelGrid> 
    </h:form> 
    </html>
    Et voilà mon interface :
    Nom : modifier.png
Affichages : 178
Taille : 101,8 Ko
    Quand j'exécute ça me retourne IndexOutOfBoundsException et quand j'enlève tous les inputtexts et que je laisse une seule zone de texte, ça fonctionne parfaitement, peu importe la zone de texte que je cherchais.

    Le message d'erreur complet:
    java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    at java.util.ArrayList.rangeCheck(Unknown Source)
    at java.util.ArrayList.get(Unknown Source)
    at tn.ooredoo.kpi.controller.ClientCtr.ChercherContact(ClientCtr.java:210)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.el.parser.AstValue.invoke(AstValue.java:278)
    at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:274)
    at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:102)
    at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:84)
    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:98)
    at javax.faces.component.UICommand.broadcast(UICommand.java:311)
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:781)
    at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1246)
    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Quelqu'un saurait-il m'indiquer comment résoudre ce problème ?

    Merci d'avance pour votre aide.

  2. #2
    Membre averti
    Homme Profil pro
    Conseil - Consultant en systèmes d'information
    Inscrit en
    Juillet 2013
    Messages
    269
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Conseil - Consultant en systèmes d'information
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juillet 2013
    Messages : 269
    Points : 434
    Points
    434
    Par défaut
    Si tu es mets un point d'arrêt dans ta méthode ChercherContact, peux tu vérifier que ta variable l contient quelque chose ?

  3. #3
    Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2015
    Messages
    5
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Janvier 2015
    Messages : 5
    Points : 4
    Points
    4
    Par défaut
    Oui ça contient un client.

  4. #4
    Membre averti
    Homme Profil pro
    Conseil - Consultant en systèmes d'information
    Inscrit en
    Juillet 2013
    Messages
    269
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Conseil - Consultant en systèmes d'information
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juillet 2013
    Messages : 269
    Points : 434
    Points
    434
    Par défaut
    Et que fais tu ensuite de ta variable clt ? Car dans ta view tu affiches clientCtr.client.
    As tu un getter pour clt ?

  5. #5
    Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2015
    Messages
    5
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Janvier 2015
    Messages : 5
    Points : 4
    Points
    4
    Par défaut
    La variable clt est une instance de la classe Client et j'ai déja fais les getters et setters et j'ai changé dans la vue clientCtr.clt mais j'ai toujours la même erreur.

  6. #6
    Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2015
    Messages
    5
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Janvier 2015
    Messages : 5
    Points : 4
    Points
    4
    Par défaut
    J'ai enlevé dans le code le l.get(0) et l'erreur ne s'affiche plus mais les informations du clients n'apparaissent pas dans le formulaire.

  7. #7
    Membre confirmé Avatar de freddou17
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2013
    Messages
    341
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Sarthe (Pays de la Loire)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Service public

    Informations forums :
    Inscription : Avril 2013
    Messages : 341
    Points : 566
    Points
    566
    Par défaut Grammaire
    C'est normal que tu n'aies plus d'infos ton obj client = new Client(), c'est tout. Il faut garder le get(0) si tu veux une entité stockée en bdd.
    Par contre pour ton erreur il faudrait la stacktrace peut-être qu'on pourra réussir à lire le problème.
    Arrives-tu à isoler la propriété de ton entité client qui pose problème? Dans la démarche j'ajouterais un à un mes inputText pour isoler celui qui déclenche l'exception

    Peux-tu fournir ton Client.hbm.xml ou Client.java stp ?
    "Aucun de nous ne sait ce que nous savons tous, ensemble."
    Lien vers mon appli Funcash n'hésitez pas à donner votre avis

  8. #8
    Membre confirmé Avatar de freddou17
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2013
    Messages
    341
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Sarthe (Pays de la Loire)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Service public

    Informations forums :
    Inscription : Avril 2013
    Messages : 341
    Points : 566
    Points
    566
    Par défaut
    Dans ton ManagedBean as tu dans ton code, une fois le client récupéré

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    client (instance Client propriété de ton ManagedBean) = clt
    Comme dit dans les messages précédents, avant de récupérer l'index 0 tester si la liste n'est pas vide.

    ++

    Edit:

    En faisant
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Client clt = new Client()
    dans ta méthode chercherContact, clt ne peux pas être propriété de la Classe Client Controller

    Peux tu nous filer ton ManagedBean stp?
    "Aucun de nous ne sait ce que nous savons tous, ensemble."
    Lien vers mon appli Funcash n'hésitez pas à donner votre avis

  9. #9
    Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2015
    Messages
    5
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Janvier 2015
    Messages : 5
    Points : 4
    Points
    4
    Par défaut
    Voilà la classe client.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
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
     package tn.ooredoo.kpi.model;
    // Generated 6 avr. 2015 11:56:22 by Hibernate Tools 3.4.0.CR1
    import java.util.HashSet;
    import java.util.Set;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.FetchType;
    import javax.persistence.Id;
    import javax.persistence.JoinColumn;
    import javax.persistence.JoinTable;
    import javax.persistence.ManyToMany;
    import javax.persistence.OneToMany;
    import javax.persistence.Table;
     
    /**
     * Client generated by hbm2java
     */
    @Entity
    @Table(name = "client", catalog = "pfe_ooredoo")
    public class Client implements java.io.Serializable {
     
        private int idSociete;
        private String nomSociete;
        private String ncgr;
        private String fqdn;
        private Integer rtgrp;
        private String outbproxy;
        private Integer route;
        private String ndest;
        private Integer operatorNumber;
        private String directoryNumber;
        private String additionalNumber;
        private Integer scri;
        private Integer upd;
        private Set<Kpi> kpis = new HashSet<Kpi>(0);
        private Set<Architecture> architectures = new HashSet<Architecture>(0);
        private Set<Administrateur> administrateurs = new HashSet<Administrateur>(0);
     
        public Client() {
        }
     
        public Client(int idSociete) {
            this.idSociete = idSociete;
        }
     
        public Client(int idSociete, String nomSociete, String ncgr, String fqdn,
                Integer rtgrp, String outbproxy, Integer route, String ndest,
                Integer operatorNumber, String directoryNumber,
                String additionalNumber, Integer scri, Integer upd, Set<Kpi> kpis,
                Set<Architecture> architectures, Set<Administrateur> administrateurs) {
            this.idSociete = idSociete;
            this.nomSociete = nomSociete;
            this.ncgr = ncgr;
            this.fqdn = fqdn;
            this.rtgrp = rtgrp;
            this.outbproxy = outbproxy;
            this.route = route;
            this.ndest = ndest;
            this.operatorNumber = operatorNumber;
            this.directoryNumber = directoryNumber;
            this.additionalNumber = additionalNumber;
            this.scri = scri;
            this.upd = upd;
            this.kpis = kpis;
            this.architectures = architectures;
            this.administrateurs = administrateurs;
        }
     
        @Id
        @Column(name = "id_Societe", unique = true, nullable = false)
        public int getIdSociete() {
            return this.idSociete;
        }
     
        public void setIdSociete(int idSociete) {
            this.idSociete = idSociete;
        }
     
        @Column(name = "nom_Societe", length = 30)
        public String getNomSociete() {
            return this.nomSociete;
        }
     
        public void setNomSociete(String nomSociete) {
            this.nomSociete = nomSociete;
        }
     
        @Column(name = "ncgr", length = 30)
        public String getNcgr() {
            return this.ncgr;
        }
     
        public void setNcgr(String ncgr) {
            this.ncgr = ncgr;
        }
     
        @Column(name = "fqdn", length = 30)
        public String getFqdn() {
            return this.fqdn;
        }
     
        public void setFqdn(String fqdn) {
            this.fqdn = fqdn;
        }
     
        @Column(name = "rtgrp")
        public Integer getRtgrp() {
            return this.rtgrp;
        }
     
        public void setRtgrp(Integer rtgrp) {
            this.rtgrp = rtgrp;
        }
     
        @Column(name = "outbproxy", length = 30)
        public String getOutbproxy() {
            return this.outbproxy;
        }
     
        public void setOutbproxy(String outbproxy) {
            this.outbproxy = outbproxy;
        }
     
        @Column(name = "route")
        public Integer getRoute() {
            return this.route;
        }
     
        public void setRoute(Integer route) {
            this.route = route;
        }
     
        @Column(name = "ndest", length = 30)
        public String getNdest() {
            return this.ndest;
        }
     
        public void setNdest(String ndest) {
            this.ndest = ndest;
        }
     
        @Column(name = "operator_Number")
        public Integer getOperatorNumber() {
            return this.operatorNumber;
        }
     
        public void setOperatorNumber(Integer operatorNumber) {
            this.operatorNumber = operatorNumber;
        }
     
        @Column(name = "directory_Number", length = 11)
        public String getDirectoryNumber() {
            return this.directoryNumber;
        }
     
        public void setDirectoryNumber(String directoryNumber) {
            this.directoryNumber = directoryNumber;
        }
     
        @Column(name = "additional_Number", length = 80)
        public String getAdditionalNumber() {
            return this.additionalNumber;
        }
     
        public void setAdditionalNumber(String additionalNumber) {
            this.additionalNumber = additionalNumber;
        }
     
        @Column(name = "scri")
        public Integer getScri() {
            return this.scri;
        }
     
        public void setScri(Integer scri) {
            this.scri = scri;
        }
     
        @Column(name = "upd")
        public Integer getUpd() {
            return this.upd;
        }
     
        public void setUpd(Integer upd) {
            this.upd = upd;
        }
     
        @OneToMany(fetch = FetchType.LAZY, mappedBy = "client")
        public Set<Kpi> getKpis() {
            return this.kpis;
        }
     
        public void setKpis(Set<Kpi> kpis) {
            this.kpis = kpis;
        }
     
        @OneToMany(fetch = FetchType.LAZY, mappedBy = "client")
        public Set<Architecture> getArchitectures() {
            return this.architectures;
        }
     
        public void setArchitectures(Set<Architecture> architectures) {
            this.architectures = architectures;
        }
     
        @ManyToMany(fetch = FetchType.LAZY)
        @JoinTable(name = "gerer", catalog = "pfe_ooredoo", joinColumns = { @JoinColumn(name = "client_id_Societe", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "administrateur_id_Admin", nullable = false, updatable = false) })
        public Set<Administrateur> getAdministrateurs() {
            return this.administrateurs;
        }
     
        public void setAdministrateurs(Set<Administrateur> administrateurs) {
            this.administrateurs = administrateurs;
        }
    }
    Et tout le stacktrace:
    avr. 24, 2015 2:29:42 PM org.apache.catalina.core.AprLifecycleListener init
    INFOS: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.8.0_31\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre1.8.0_31/bin/client;C:/Program Files/Java/jre1.8.0_31/bin;C:/Program Files/Java/jre1.8.0_31/lib/i386;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;;;C:\Program Files\MySQL\MySQL Server 5.5\bin;C:\Program Files\Skype\Phone\;D:\PFE_workspace\eclipse_kepler;;.
    avr. 24, 2015 2:29:43 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
    AVERTISSEMENT: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:rr' did not find a matching property.
    avr. 24, 2015 2:29:43 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
    AVERTISSEMENT: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:TP_JSF_HIBERNATE' did not find a matching property.
    avr. 24, 2015 2:29:43 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
    AVERTISSEMENT: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.serverEMO_HIBER_JSF' did not find a matching property.
    avr. 24, 2015 2:29:43 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
    AVERTISSEMENT: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:gestionKPI' did not find a matching property.
    avr. 24, 2015 2:29:43 PM org.apache.coyote.AbstractProtocol init
    INFOS: Initializing ProtocolHandler ["http-bio-8089"]
    avr. 24, 2015 2:29:43 PM org.apache.coyote.AbstractProtocol init
    INFOS: Initializing ProtocolHandler ["ajp-bio-8001"]
    avr. 24, 2015 2:29:43 PM org.apache.catalina.startup.Catalina load
    INFOS: Initialization processed in 451 ms
    avr. 24, 2015 2:29:43 PM org.apache.catalina.core.StandardService startInternal
    INFOS: Démarrage du service Catalina
    avr. 24, 2015 2:29:43 PM org.apache.catalina.core.StandardEngine startInternal
    INFOS: Starting Servlet Engine: Apache Tomcat/7.0.30
    avr. 24, 2015 2:29:44 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom
    INFOS: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [136] milliseconds.
    avr. 24, 2015 2:29:44 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
    INFOS: validateJarFile(D:\PFE_workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\gestionKPI\WEB-INF\lib\javax.servlet-api-3.0.1.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
    avr. 24, 2015 2:29:47 PM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jstl/core_rt is already defined
    avr. 24, 2015 2:29:47 PM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jstl/core is already defined
    avr. 24, 2015 2:29:47 PM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jsp/jstl/core is already defined
    avr. 24, 2015 2:29:47 PM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jstl/fmt_rt is already defined
    avr. 24, 2015 2:29:47 PM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jstl/fmt is already defined
    avr. 24, 2015 2:29:47 PM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jsp/jstl/fmt is already defined
    avr. 24, 2015 2:29:47 PM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jsp/jstl/functions is already defined
    avr. 24, 2015 2:29:47 PM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://jakarta.apache.org/taglibs/st...rmittedTaglibs is already defined
    avr. 24, 2015 2:29:47 PM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/scriptfree is already defined
    avr. 24, 2015 2:29:47 PM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jstl/sql_rt is already defined
    avr. 24, 2015 2:29:47 PM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jstl/sql is already defined
    avr. 24, 2015 2:29:47 PM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jsp/jstl/sql is already defined
    avr. 24, 2015 2:29:47 PM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jstl/xml_rt is already defined
    avr. 24, 2015 2:29:47 PM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jstl/xml is already defined
    avr. 24, 2015 2:29:47 PM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jsp/jstl/xml is already defined
    avr. 24, 2015 2:29:47 PM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://mojarra.dev.java.net/mojarra_ext is already defined
    avr. 24, 2015 2:29:47 PM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI:
    http://java.sun.com/jsf/html
    is already defined
    avr. 24, 2015 2:29:47 PM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jsf/core is already defined
    avr. 24, 2015 2:29:47 PM com.sun.faces.config.ConfigureListener contextInitialized
    INFOS: Initialisation de Mojarra 2.0.3 (SNAPSHOT 20100726) pour le contexte '/gestionKPI'
    avr. 24, 2015 2:29:48 PM com.sun.faces.spi.InjectionProviderFactory createInstance
    INFOS: JSF1048 : Présence d''annotations PostConstruct/PreDestroy Les méthodes de beans gérés marquées avec ces annotations auront des annotations dites traitées.
    avr. 24, 2015 2:29:49 PM org.primefaces.webapp.PostConstructApplicationEventListener processEvent
    INFOS: Running on PrimeFaces 3.5
    avr. 24, 2015 2:29:49 PM com.sun.faces.config.ConfigureListener$WebConfigResourceMonitor$Monitor <init>
    INFOS: Monitoring jndi:/localhost/gestionKPI/WEB-INF/faces-config.xml for modifications
    avr. 24, 2015 2:29:51 PM com.sun.faces.config.ConfigureListener contextInitialized
    INFOS: Initialisation de Mojarra 2.0.3 (SNAPSHOT 20100726) pour le contexte '/DEMO_HIBER_JSF'
    avr. 24, 2015 2:29:51 PM com.sun.faces.spi.InjectionProviderFactory createInstance
    INFOS: JSF1048 : Présence d''annotations PostConstruct/PreDestroy Les méthodes de beans gérés marquées avec ces annotations auront des annotations dites traitées.
    avr. 24, 2015 2:29:52 PM org.primefaces.webapp.PostConstructApplicationEventListener processEvent
    INFOS: Running on PrimeFaces 3.5
    avr. 24, 2015 2:29:52 PM com.sun.faces.config.ConfigureListener$WebConfigResourceMonitor$Monitor <init>
    INFOS: Monitoring jndi:/localhost/DEMO_HIBER_JSF/WEB-INF/faces-config.xml for modifications
    avr. 24, 2015 2:29:52 PM org.apache.coyote.AbstractProtocol start
    INFOS: Starting ProtocolHandler ["http-bio-8089"]
    avr. 24, 2015 2:29:52 PM org.apache.coyote.AbstractProtocol start
    INFOS: Starting ProtocolHandler ["ajp-bio-8001"]
    avr. 24, 2015 2:29:52 PM org.apache.catalina.startup.Catalina start
    INFOS: Server startup in 9698 ms
    - Hibernate Annotations 3.3.1.GA
    - Hibernate 3.2.6
    - hibernate.properties not found
    - Bytecode provider name : cglib
    - using JDK 1.4 java.sql.Timestamp handling
    - configuring from resource: /hibernate.cfg.xml
    - Configuration resource: /hibernate.cfg.xml
    - Configured SessionFactory: null
    - Binding entity from annotated class: tn.ooredoo.kpi.model.Employe
    - Bind entity tn.ooredoo.kpi.model.Employe on table employe
    - Binding entity from annotated class: tn.ooredoo.kpi.model.Client
    - Bind entity tn.ooredoo.kpi.model.Client on table client
    - Binding entity from annotated class: tn.ooredoo.kpi.model.User
    - Bind entity tn.ooredoo.kpi.model.User on table user
    - Binding entity from annotated class: tn.ooredoo.kpi.model.Administrateur
    - Bind entity tn.ooredoo.kpi.model.Administrateur on table administrateur
    - Binding entity from annotated class: tn.ooredoo.kpi.model.Architecture
    - Bind entity tn.ooredoo.kpi.model.Architecture on table architecture
    - Binding entity from annotated class: tn.ooredoo.kpi.model.Kpi
    - Bind entity tn.ooredoo.kpi.model.Kpi on table kpi
    - Binding entity from annotated class: tn.ooredoo.kpi.model.Diagrams
    - Bind entity tn.ooredoo.kpi.model.Diagrams on table diagrams
    - Mapping collection: tn.ooredoo.kpi.model.Employe.administrateurs -> administrateur
    - Mapping collection: tn.ooredoo.kpi.model.Client.architectures -> architecture
    - Mapping collection: tn.ooredoo.kpi.model.Client.kpis -> kpi
    - Mapping collection: tn.ooredoo.kpi.model.User.employes -> employe
    - Mapping collection: tn.ooredoo.kpi.model.Kpi.diagramses -> diagrams
    - Hibernate Validator not found: ignoring
    - Using Hibernate built-in connection pool (not for production use!)
    - Hibernate connection pool size: 20
    - autocommit mode: false
    - using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost:3306/pfe_ooredoo
    - connection properties: {user=root, password=****}
    - RDBMS: MySQL, version: 5.5.24
    - JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.1.10 ( Revision: ${svn.Revision} )
    - Using dialect: org.hibernate.dialect.MySQLDialect
    - Using default transaction strategy (direct JDBC transactions)
    - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
    - Automatic flush during beforeCompletion(): disabled
    - Automatic session close at end of transaction: disabled
    - JDBC batch size: 15
    - JDBC batch updates for versioned data: disabled
    - Scrollable result sets: enabled
    - JDBC3 getGeneratedKeys(): enabled
    - Connection release mode: auto
    - Maximum outer join fetch depth: 2
    - Default batch fetch size: 1
    - Generate SQL with comments: disabled
    - Order SQL updates by primary key: disabled
    - Order SQL inserts for batching: disabled
    - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
    - Using ASTQueryTranslatorFactory
    - Query language substitutions: {}
    - JPA-QL strict compliance: disabled
    - Second-level cache: enabled
    - Query cache: disabled
    - Cache provider: org.hibernate.cache.NoCacheProvider
    - Optimize cache for minimal puts: disabled
    - Structured second-level cache entries: disabled
    - Statistics: disabled
    - Deleted entity synthetic identifier rollback: disabled
    - Default entity-mode: pojo
    - Named query checking : enabled
    - building session factory
    - Not binding factory to JNDI, no JNDI name configured
    id 0
    java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    at java.util.ArrayList.rangeCheck(Unknown Source)
    at java.util.ArrayList.get(Unknown Source)
    at tn.ooredoo.kpi.controller.ClientCtr.ChercherContact(ClientCtr.java:219)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.el.parser.AstValue.invoke(AstValue.java:278)
    at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:274)
    at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:102)
    at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:84)
    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:98)
    at javax.faces.component.UICommand.broadcast(UICommand.java:311)
    at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:781)
    at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1246)
    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Et concernant le Client client = new Client() je l'ai fais deja comme attribut privée de la classe ClientCtr

    Ma méthode est celle-ci :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    public void ChercherContact() {
            try {
     
                System.out.println("id             " + idSociete);
                Criterion critere = Restrictions.eq("idSociete",
                        client.getIdSociete());
                List<Client> l = ClientDao.findByCriteria(Client.class, critere);
                client = l.get(0);
            } catch (Exception e) {
                e.printStackTrace();
            }
    }

Discussions similaires

  1. Utiliser une méthode d'une instance, dans une callback
    Par qdaemon_fr dans le forum Langage
    Réponses: 3
    Dernier message: 18/04/2014, 18h09
  2. [ATL] Utiliser une instance d'une règle dans une autre règle
    Par sacha33 dans le forum Eclipse Modeling
    Réponses: 0
    Dernier message: 02/06/2013, 23h41
  3. [Toutes versions] coller les données d'une plage d'une cellule dans une cellule d'une autre feuille[VBA]
    Par arthson dans le forum Macros et VBA Excel
    Réponses: 1
    Dernier message: 24/01/2012, 17h37

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