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 :

PB de reflection


Sujet :

Hibernate Java

  1. #1
    Membre averti
    Inscrit en
    Septembre 2007
    Messages
    21
    Détails du profil
    Informations forums :
    Inscription : Septembre 2007
    Messages : 21
    Par défaut PB de reflection
    Bonjour a tous,
    Je suis débutant sur Hibernate et j'ai choisit un environnement costaud pour m'initier.
    Je developpe une application J2EE sur un serveur JBOSS avec comme SGBD Oracle 9i.
    J'ai utilisé Hibernate 3 pour la persistance.

    Voici en mon Probleme.
    Avec HibernateSynchonize de Eclipse, j'ai generer le fichier Hbn et les classes correspondantes. La classe base qui a été généré a 30 methode (getter et setter).
    mais lorsque je deploie le har sur mon serveur JBoss, il ne retrouve que 28 methode dans la classe ce qui fait qu'il me genere l'erreur suivante sur un champ:
    17:55:18,205 WARN [ServiceController] Problem starting service AssurHibernate.har:service=Hibernate
    org.hibernate.PropertyNotFoundException: Could not find a getter for DateLevee in class com.afrikbrain.iard.srv.interm.SuspensionInter
    at org.hibernate.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:282)


    MErci de vos proposition

  2. #2
    Modérateur
    Avatar de OButterlin
    Homme Profil pro
    Inscrit en
    Novembre 2006
    Messages
    7 313
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 7 313
    Billets dans le blog
    1
    Par défaut
    Il faudrait nous montrer :

    - la structure de la table
    - le fichier hbm.xml
    - le pojo associé

    A+
    N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

  3. #3
    Membre averti
    Inscrit en
    Septembre 2007
    Messages
    21
    Détails du profil
    Informations forums :
    Inscription : Septembre 2007
    Messages : 21
    Par défaut Description des structures
    merci à OButterlin pour sa réaction.
    Voila les complements délément qu'il a demandé.

    - la structure de la table
    CREATE TABLE NOYP_SUSPENSION_INTER
    (
    ID VARCHAR2(25 BYTE) NOT NULL,
    CODE_INTER VARCHAR2(25 BYTE) NOT NULL,
    DATE_EFFET_SUSPINT DATE NOT NULL,
    DATESUSP_SUSPINT DATE,
    MOTIF_SUSPINT VARCHAR2(1000 BYTE),
    DTE_UTI_SUSPINT DATE NOT NULL,
    CODE_UTI VARCHAR2(20 BYTE) NOT NULL,
    CODE_UTI_MODIF VARCHAR2(20 BYTE),
    DTE_UTI_MODIF DATE,
    CODE_UNITE VARCHAR2(25 BYTE) NOT NULL,
    MOTIF_LEVEE_SUSPINT VARCHAR2(1000 BYTE),
    SUSPLEVEE_SUSPINT VARCHAR2(1 BYTE) NOT NULL,
    DATE_LEVEE_SUSPINT DATE
    );

    CREATE UNIQUE INDEX PK_SUSPENSION_INTER ON NOYP_SUSPENSION_INTER
    (ID);

    - le fichier hbm.xml
    <?xml version="1.0"?>
    <!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >

    <hibernate-mapping package="com.afrikbrain.iard.srv.interm">
    <class
    name="SuspensionInter"
    table="NOYP_SUSPENSION_INTER"
    >
    <meta attribute="sync-DAO">false</meta>
    <id
    name="Id"
    type="string"
    column="ID"
    >
    <generator class="assigned"/>
    </id>

    <property
    name="DateEffet"
    column="DATE_EFFET_SUSPINT"
    type="date"
    not-null="true"
    length="7"
    />
    <property
    name="DateSusp"
    column="DATESUSP_SUSPINT"
    type="date"
    not-null="false"
    length="7"
    />
    <property
    name="MotifSusp"
    column="MOTIF_SUSPINT"
    type="string"
    not-null="false"
    length="1000"
    />
    <property
    name="DteUtiSusp"
    column="DTE_UTI_SUSPINT"
    type="date"
    not-null="true"
    length="7"
    />
    <property
    name="CodeUti"
    column="CODE_UTI"
    type="string"
    not-null="true"
    length="20"
    />
    <property
    name="CodeUtiModif"
    column="CODE_UTI_MODIF"
    type="string"
    not-null="false"
    length="20"
    />
    <property
    name="DteUtiModif"
    column="DTE_UTI_MODIF"
    type="date"
    not-null="false"
    length="7"
    />
    <property
    name="MotifLevee"
    column="MOTIF_LEVEE_SUSPINT"
    type="string"
    not-null="false"
    length="1000"
    />
    <property
    name="EstLevee"
    column="SUSPLEVEE_SUSPINT"
    type="string"
    not-null="true"
    length="1"
    />
    <property
    name="DateLevee"
    column="DATE_LEVEE_SUSPINT"
    type="date"
    not-null="true"
    length="7"
    />
    <many-to-one
    name="Unite"
    column="CODE_UNITE"
    class="com.afrikbrain.iard.srv.ref.Unite"
    not-null="true"
    >
    </many-to-one>
    <many-to-one
    name="Intermédiaire"
    column="CODE_INTER"
    class="Intermediaire"
    not-null="true"
    >
    </many-to-one>


    </class>
    </hibernate-mapping>

    - le pojo associé
    J'espère que je ne me suis pas trompé pour ce point

    package com.afrikbrain.iard.srv.interm.base;
    import java.io.Serializable;
    /**
    * This is an object that contains data related to the NOYP_SUSPENSION_INTER table.
    * Do not modify this class because it will be overwritten if the configuration file
    * related to this class is modified.
    *
    * @hibernate.class
    * table="NOYP_SUSPENSION_INTER"
    */

    public abstract class BaseSuspensionInter implements Serializable {

    public static String REF = "SuspensionInter";
    public static String PROP_CODE_UTI = "CodeUti";
    public static String PROP_DATE_EFFET = "DateEffet";
    public static String PROP_INTERMÉDIAIRE = "Intermédiaire";
    public static String PROP_DTE_UTI_SUSP = "DteUtiSusp";
    public static String PROP_MOTIF_SUSP = "MotifSusp";
    public static String PROP_DATE_LEVEE = "DateLevee";
    public static String PROP_CODE_UTI_MODIF = "CodeUtiModif";
    public static String PROP_DATE_SUSP = "DateSusp";
    public static String PROP_UNITE = "Unite";
    public static String PROP_ID = "Id";
    public static String PROP_EST_LEVEE = "EstLevee";
    public static String PROP_DTE_UTI_MODIF = "DteUtiModif";
    public static String PROP_MOTIF_LEVEE = "MotifLevee";


    // constructors
    public BaseSuspensionInter () {
    initialize();
    }

    /**
    * Constructor for primary key
    */
    public BaseSuspensionInter (java.lang.String id) {
    this.setId(id);
    initialize();
    }

    /**
    * Constructor for required fields
    */
    public BaseSuspensionInter (
    java.lang.String id,
    com.afrikbrain.iard.srv.ref.Unite unite,
    com.afrikbrain.iard.srv.interm.Intermediaire intermédiaire,
    java.util.Date dateEffet,
    java.util.Date dteUtiSusp,
    java.lang.String codeUti,
    java.lang.String estLevee,
    java.util.Date dateLevee) {

    this.setId(id);
    this.setUnite(unite);
    this.setIntermédiaire(intermédiaire);
    this.setDateEffet(dateEffet);
    this.setDteUtiSusp(dteUtiSusp);
    this.setCodeUti(codeUti);
    this.setEstLevee(estLevee);
    this.setDateLevee(dateLevee);
    initialize();
    }

    protected void initialize () {}



    private int hashCode = Integer.MIN_VALUE;

    // primary key
    private java.lang.String id;

    // fields
    private java.util.Date dateEffet;
    private java.util.Date dateSusp;
    private java.lang.String motifSusp;
    private java.util.Date dteUtiSusp;
    private java.lang.String codeUti;
    private java.lang.String codeUtiModif;
    private java.util.Date dteUtiModif;
    private java.lang.String motifLevee;
    private java.lang.String estLevee;
    private java.util.Date dateLevee;

    // many to one
    private com.afrikbrain.iard.srv.ref.Unite unite;
    private com.afrikbrain.iard.srv.interm.Intermediaire intermédiaire;



    /**
    * Return the unique identifier of this class
    * @hibernate.id
    * generator-class="assigned"
    * column="ID"
    */
    public java.lang.String getId () {
    return id;
    }

    /**
    * Set the unique identifier of this class
    * @param id the new ID
    */
    public void setId (java.lang.String id) {
    this.id = id;
    this.hashCode = Integer.MIN_VALUE;
    }

    /**
    * Return the value associated with the column: DATE_EFFET_SUSPINT
    */
    public java.util.Date getDateEffet () {
    return dateEffet;
    }

    /**
    * Set the value related to the column: DATE_EFFET_SUSPINT
    * @param dateEffet the DATE_EFFET_SUSPINT value
    */
    public void setDateEffet (java.util.Date dateEffet) {
    this.dateEffet = dateEffet;
    }

    /**
    * Return the value associated with the column: DATESUSP_SUSPINT
    */
    public java.util.Date getDateSusp () {
    return dateSusp;
    }

    /**
    * Set the value related to the column: DATESUSP_SUSPINT
    * @param dateSusp the DATESUSP_SUSPINT value
    */
    public void setDateSusp (java.util.Date dateSusp) {
    this.dateSusp = dateSusp;
    }

    /**
    * Return the value associated with the column: MOTIF_SUSPINT
    */
    public java.lang.String getMotifSusp () {
    return motifSusp;
    }

    /**
    * Set the value related to the column: MOTIF_SUSPINT
    * @param motifSusp the MOTIF_SUSPINT value
    */
    public void setMotifSusp (java.lang.String motifSusp) {
    this.motifSusp = motifSusp;
    }

    /**
    * Return the value associated with the column: DTE_UTI_SUSPINT
    */
    public java.util.Date getDteUtiSusp () {
    return dteUtiSusp;
    }

    /**
    * Set the value related to the column: DTE_UTI_SUSPINT
    * @param dteUtiSusp the DTE_UTI_SUSPINT value
    */
    public void setDteUtiSusp (java.util.Date dteUtiSusp) {
    this.dteUtiSusp = dteUtiSusp;
    }

    /**
    * Return the value associated with the column: CODE_UTI
    */
    public java.lang.String getCodeUti () {
    return codeUti;
    }

    /**
    * Set the value related to the column: CODE_UTI
    * @param codeUti the CODE_UTI value
    */
    public void setCodeUti (java.lang.String codeUti) {
    this.codeUti = codeUti;
    }

    /**
    * Return the value associated with the column: CODE_UTI_MODIF
    */
    public java.lang.String getCodeUtiModif () {
    return codeUtiModif;
    }

    /**
    * Set the value related to the column: CODE_UTI_MODIF
    * @param codeUtiModif the CODE_UTI_MODIF value
    */
    public void setCodeUtiModif (java.lang.String codeUtiModif) {
    this.codeUtiModif = codeUtiModif;
    }

    /**
    * Return the value associated with the column: DTE_UTI_MODIF
    */
    public java.util.Date getDteUtiModif () {
    return dteUtiModif;
    }

    /**
    * Set the value related to the column: DTE_UTI_MODIF
    * @param dteUtiModif the DTE_UTI_MODIF value
    */
    public void setDteUtiModif (java.util.Date dteUtiModif) {
    this.dteUtiModif = dteUtiModif;
    }

    /**
    * Return the value associated with the column: MOTIF_LEVEE_SUSPINT
    */
    public java.lang.String getMotifLevee () {
    return motifLevee;
    }

    /**
    * Set the value related to the column: MOTIF_LEVEE_SUSPINT
    * @param motifLevee the MOTIF_LEVEE_SUSPINT value
    */
    public void setMotifLevee (java.lang.String motifLevee) {
    this.motifLevee = motifLevee;
    }

    /**
    * Return the value associated with the column: SUSPLEVEE_SUSPINT
    */
    public java.lang.String getEstLevee () {
    return estLevee;
    }

    /**
    * Set the value related to the column: SUSPLEVEE_SUSPINT
    * @param estLevee the SUSPLEVEE_SUSPINT value
    */
    public void setEstLevee (java.lang.String estLevee) {
    this.estLevee = estLevee;
    }


    /**
    * Return the value associated with the column: DATE_LEVEE_SUSPINT
    */
    public java.util.Date getDateLevee () {
    return dateLevee;
    }

    /**
    * Set the value related to the column: DATE_LEVEE_SUSPINT
    * @param dateLevee the DATE_LEVEE_SUSPINT value
    */
    public void setDateLevee (java.util.Date dateLevee) {
    this.dateLevee = dateLevee;
    }


    /**
    * Return the value associated with the column: CODE_UNITE
    */
    public com.afrikbrain.iard.srv.ref.Unite getUnite () {
    return unite;
    }

    /**
    * Set the value related to the column: CODE_UNITE
    * @param unite the CODE_UNITE value
    */
    public void setUnite (com.afrikbrain.iard.srv.ref.Unite unite) {
    this.unite = unite;
    }


    /**
    * Return the value associated with the column: CODE_INTER
    */
    public com.afrikbrain.iard.srv.interm.Intermediaire getIntermédiaire () {
    return intermédiaire;
    }

    /**
    * Set the value related to the column: CODE_INTER
    * @param intermédiaire the CODE_INTER value
    */
    public void setIntermédiaire (com.afrikbrain.iard.srv.interm.Intermediaire intermédiaire) {
    this.intermédiaire = intermédiaire;
    }

    public boolean equals (Object obj) {
    if (null == obj) return false;
    if (!(obj instanceof com.afrikbrain.iard.srv.interm.SuspensionInter)) return false;
    else {
    com.afrikbrain.iard.srv.interm.SuspensionInter suspensionInter = (com.afrikbrain.iard.srv.interm.SuspensionInter) obj;
    if (null == this.getId() || null == suspensionInter.getId()) return false;
    else return (this.getId().equals(suspensionInter.getId()));
    }
    }

    public int hashCode () {
    if (Integer.MIN_VALUE == this.hashCode) {
    if (null == this.getId()) return super.hashCode();
    else {
    String hashStr = this.getClass().getName() + ":" + this.getId().hashCode();
    this.hashCode = hashStr.hashCode();
    }
    }
    return this.hashCode;
    }

    public String toString () {
    return super.toString();
    }
    }

  4. #4
    Membre Expert
    Profil pro
    Inscrit en
    Août 2006
    Messages
    3 274
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 3 274
    Par défaut
    Dans ton mapping, tes attributs doivent commencer par une minuscule, comme dans tes classes.
    Donc essaie :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    <property
    name="dateLevee"
    column="DATE_LEVEE_SUSPINT"
    type="date"
    not-null="true"
    length="7"
    />
    Et fais pareil pour tous les attributs.

  5. #5
    Membre averti
    Inscrit en
    Septembre 2007
    Messages
    21
    Détails du profil
    Informations forums :
    Inscription : Septembre 2007
    Messages : 21
    Par défaut Merci
    Merci fr1man!
    Ta solution a résolue tout mes pb.

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

Discussions similaires

  1. [Reflection] Probleme d'appel newInstance()
    Par SEMPERE Benjamin dans le forum API standards et tierces
    Réponses: 2
    Dernier message: 17/06/2004, 13h15
  2. [Reflection] Exécuter une méthode donnée d'une classe
    Par schousso dans le forum API standards et tierces
    Réponses: 4
    Dernier message: 03/06/2004, 10h35
  3. [Reflection]Probleme d'InstantiationException
    Par guipom dans le forum API standards et tierces
    Réponses: 6
    Dernier message: 23/05/2004, 23h28
  4. [Reflection][Bean] Appel d'une méthode dynamiquement
    Par eraim dans le forum API standards et tierces
    Réponses: 2
    Dernier message: 28/04/2004, 11h07
  5. Reflections
    Par Laurent Gomila dans le forum DirectX
    Réponses: 4
    Dernier message: 25/07/2003, 14h42

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