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

Spring Web Java Discussion :

[Spring MVC] Remplissage d'un combo depuis un BD


Sujet :

Spring Web Java

  1. #1
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2005
    Messages
    163
    Détails du profil
    Informations personnelles :
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Avril 2005
    Messages : 163
    Points : 86
    Points
    86
    Par défaut [Spring MVC] Remplissage d'un combo depuis un BD
    Salut,
    j'ai le warning suivant
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    no persistent classes found for query class : ...
    Mon probléme est le suivant : J'essaye de récuperer des champs de ma BD pour les mettrent ds un comboBox, pour cela j'utlise une methode qui accéde à la BD et me récupére les données de la table, or cette méthode ne récupére rien sachant que la table contient bien des données.
    voila le bout de code que j'utlise pour récupérer de la bd
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
    public List getAllDroit() {
    		return getHibernateTemplate().find(
    		"select com.pia.agp.mapping.Droit.droitId from com.pia.agp.mapping.Droit ");
    	}
    mon controleur
    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
    protected Map referenceData(HttpServletRequest request, Object model, Errors errors) throws Exception {
    		Map data = new HashMap();
    		//data.putAll(super.referenceData(request, model, errors));
     
    		if (errors.hasErrors()) {
     
    			System.out.println("Errors found.....................");
     
    			for (Iterator iter = errors.getAllErrors().iterator(); iter.hasNext();){
    				ObjectError error = (ObjectError) iter.next();
     
    				System.out.println("ERROR: " + error.getDefaultMessage());
    			}
     
    		}	
     
    		// les options du combo (les fonctions d'un intervenant)
    		data.put("optionsComboFonction",service.getOptionsComboFonction());
     
    		//les options du combo (les couts journalier d'un intervenant)
    		data.put("optionsComboCoutExpPia",service.getCoutExpPiaCombo());
     
    		data.put("optionsComboDroit",service.getDroitCombo());
     
    		// on rend le dictionnaire
    		return data;
    	}
    le code getDroitCombo
    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 String[] getDroitCombo() {
    		System.out.println("Get droit combo ");
    		int i = 0;
    		/* on appel la methode de la couche DAO qui recupere les donnees de la BD*/
    		List list = dao.getAllDroit();
    		String temp[] = new String[list.size()];
    		System.out.println("SIZE : "+list.size());
    		/* On boucle sur notre list pour remplir le tableau de string */
    		for (Iterator iter = list.iterator(); iter.hasNext();){
    			temp[i++] = (String) iter.next();
    			System.out.println(temp[i-1]);
    		}
    		return temp;
     
    	}
    et le message affché ds le log de Tomcat est
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    Get droit combo 
     WARN [http-8081-Processor25] - no persistent classes found for query class: select com.pia.agp.mapping.Droit.droitId from com.pia.agp.mapping.Droit 
    taille : 0
    Ce qui me trouble, c'est que j'arrive bien à récuperer d'autres données d'une autre table.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    return getHibernateTemplate().find(
    	    		"from com.pia.agp.mapping.Intervenant ");
    celle ci marche, je recupere bien les donnees de intervenant mais je les affichent ds une liste et pas ds un combo

    Avez vous une idée du probléme que j'ai?

    Merci a ts

  2. #2
    Membre confirmé
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    365
    Détails du profil
    Informations personnelles :
    Localisation : Maroc

    Informations forums :
    Inscription : Janvier 2006
    Messages : 365
    Points : 495
    Points
    495
    Par défaut
    Bonjour,
    Et si tu essayais ça plutôt :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    public List getAllDroit() {
     return getHibernateTemplate().find("select droitId from com.pia.agp.mapping.Droit ");
    }
    Là il devrait te renvoyer uniquement la liste des IDs.
    SCJP 5 / SCBCD 1.3 Certified

  3. #3
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2005
    Messages
    163
    Détails du profil
    Informations personnelles :
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Avril 2005
    Messages : 163
    Points : 86
    Points
    86
    Par défaut
    salut, merci pour ta reponse.
    c'est ce que j'avais au debut et ca marché pas, alors je me suis dit qu'il fallait spécifier le chemin du champs, c'est pour ça j'ai rajouté com.pia.... .
    de toute façon je vais ressayer, on sait jamais
    je te tiens au courant
    merci

  4. #4
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2005
    Messages
    163
    Détails du profil
    Informations personnelles :
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Avril 2005
    Messages : 163
    Points : 86
    Points
    86
    Par défaut
    salut,
    ça ne change rien.
    Merci quand meme

  5. #5
    Membre confirmé
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    365
    Détails du profil
    Informations personnelles :
    Localisation : Maroc

    Informations forums :
    Inscription : Janvier 2006
    Messages : 365
    Points : 495
    Points
    495
    Par défaut
    Oui, je vois. Il faut peut-être faire ceci :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    "select droit.droitId from com.pia.agp.mapping.Droit droit"
    SCJP 5 / SCBCD 1.3 Certified

  6. #6
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2005
    Messages
    163
    Détails du profil
    Informations personnelles :
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Avril 2005
    Messages : 163
    Points : 86
    Points
    86
    Par défaut
    ok je vais essayer

  7. #7
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2005
    Messages
    163
    Détails du profil
    Informations personnelles :
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Avril 2005
    Messages : 163
    Points : 86
    Points
    86
    Par défaut
    tjrs aucun changement, mais tu sais meme si j'essaye de recuperer tous les champs de la table ça marche pas c-a-d si je fais
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    from com.pia.agp.mapping.Droit
    c'est pour ça que le Warning que j'ai a surement une relation avec ça.
    mais comme j'ai dis plus haut si je fais
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    from com.pia.agp.mapping.Intervenant
    ça marche et je recupere bien mes donnees.

    merci bien

  8. #8
    Membre confirmé
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    365
    Détails du profil
    Informations personnelles :
    Localisation : Maroc

    Informations forums :
    Inscription : Janvier 2006
    Messages : 365
    Points : 495
    Points
    495
    Par défaut
    Et tu es sûr que la classe est bien mappée ? Tu pourrais nous montrer les fichiers de mapping et le fichier de configuration hibernate ?
    SCJP 5 / SCBCD 1.3 Certified

  9. #9
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2005
    Messages
    163
    Détails du profil
    Informations personnelles :
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Avril 2005
    Messages : 163
    Points : 86
    Points
    86
    Par défaut
    Biensur les voila,
    Droit.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
    package com.pia.agp.mapping;
     
    import java.io.Serializable;
    import org.apache.commons.lang.builder.ToStringBuilder;
     
     
    /** @author Hibernate CodeGenerator */
    public class Droit implements Serializable {
     
        /** identifier field */
        private Long droitId;
     
        /** nullable persistent field */
        private String droitDroit;
     
        /** full constructor */
        public Droit(Long droitId, String droitDroit) {
            this.droitId = droitId;
            this.droitDroit = droitDroit;
        }
     
        /** default constructor */
        public Droit() {
        }
     
        /** minimal constructor */
        public Droit(Long droitId) {
            this.droitId = droitId;
        }
     
        public Long getDroitId() {
            return this.droitId;
        }
     
        public void setDroitId(Long droitId) {
            this.droitId = droitId;
        }
     
        public String getDroitDroit() {
            return this.droitDroit;
        }
     
        public void setDroitDroit(String droitDroit) {
            this.droitDroit = droitDroit;
        }
     
        public String toString() {
            return new ToStringBuilder(this)
                .append("droitId", getDroitId())
                .toString();
        }
     
    }
    Droit.hbm.xml
    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
    <?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>
    <!-- 
        Created by the Middlegen Hibernate plugin 2.2
     
        http://boss.bekk.no/boss/middlegen/
        http://www.hibernate.org/
    -->
     
    <class 
        name="com.pia.agp.mapping.Droit" 
        table="droit"
        lazy="false"
    >
     
        <id
            name="droitId"
            type="java.lang.Long"
            column="DROIT_ID"
        >
     
            <generator class="assigned" />
        </id>
     
        <property
            name="droitDroit"
            type="java.lang.String"
            column="DROIT_DROIT"
            length="30"
        />
     
        <!-- Associations -->
     
     
    </class>
    </hibernate-mapping>
    middelgen-build.xml
    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
    <?xml version="1.0" encoding="utf-8"?>
     
    <!--
      This build file is generated by MiddlegenIDE.
     
      MiddlegenIDE: http://ultimania.org/middlegenide/
    -->
     
    <project name="Middlegen Hibernate" default="compile" basedir=".">
       <property file="./build.properties"/>
       <property name="hibernate.cascade"    value="all" />
       <property name="package"              value="com.pia.agp.mapping" />
       <property name="gen.xdoclet-tag"      value="false" />
       <property name="gui"                  value="true" />
       <property name="jdbc.jar"             value="C:\Documents and Settings\jamal\Mes documents\Appli\AGP-Prototype\WEB-INF\lib\mysql-connector-java-3.1.9-bin.jar" />
       <property name="database.driver"      value="com.mysql.jdbc.Driver" />
       <property name="lib.dir"              value="/C:/Documents and Settings/jamal/Mes documents/LOGICIELS/wtp-all-in-one-sdk-R-1.5.0-200606281455-win32/eclipse/plugins/net.sf.middlegen_2.1.91/lib/" />
       <property name="database.url"         value="jdbc:mysql://localhost/bd_agp" />
       <property name="database.userid"      value="root" />
       <property name="database.password"    value="" />
       <property name="database.schema"      value="ROOT" />
       <property name="database.catalog"     value="" />
       <property name="dest.dir"             value="WEB-INF/src" />
     
       <target name="init" depends="prepare,fail-if-no-middlegen,fail-if-no-hibernate,fail-if-no-hibernate-ext">
     
         <taskdef
            name="middlegen"
            classname="middlegen.MiddlegenTask"
            classpathref="middlegen.classpath"
         />
     
         <taskdef
            name="hbm2java"
            classname="net.sf.hibernate.tool.hbm2java.Hbm2JavaTask"
            classpathref="hibernate-ext.classpath"
         />
     
        <mkdir dir="${dest.dir}"/>
     
       </target>
     
       <target name="prepare">
     
         <path id="middlegen.classpath">
            <pathelement path="${jdbc.jar}"/>
            <fileset dir="${lib.dir}" includes="*.jar"/>
         </path>
     
         <path id="hibernate-ext.classpath">
           <fileset dir="${lib.dir}"           includes="*.jar"/>
         </path>
     
         <available property="middlegen" classname="middlegen.MiddlegenTask" classpathref="middlegen.classpath"/>
         <available property="hibernate" classname="net.sf.hibernate.Hibernate" classpathref="hibernate-ext.classpath"/>
         <available property="hibernate-ext" classname="net.sf.hibernate.tool.hbm2java.Hbm2JavaTask" classpathref="hibernate-ext.classpath"/>
     
     
       </target>
     
       <target name="fail-if-no-middlegen" unless="middlegen">
          <fail>
          Middlegen is not found. Please install Middlegen.
          </fail>
       </target>
     
       <target name="fail-if-no-hibernate" unless="hibernate">
          <fail>
          Hibernate is not found. Please install Hibernate.
          </fail>
       </target>
     
       <target name="fail-if-no-hibernate-ext" unless="hibernate-ext">
          <fail>
          Hibernate-Extension is not found. Please install Hibernate-Extenstion.
          </fail>
       </target>
     
       <target name="gen-hbm" depends="init">
     
        <middlegen
             appname="com.pia.agp.mapping"
             prefsdir="."
             gui="true"
             databaseurl="${database.url}"
             driver="${database.driver}"
             username="${database.userid}"
             password="${database.password}"
             schema="${database.schema}"
             catalog="${database.catalog}"
          >
             <hibernate
             	version="3.0"
                destination="${dest.dir}"
                package="${package}"
                genXDocletTags="${gen.xdoclet-tag}"
           	    standardCascade="${hibernate.cascade}"
    	    javaTypeMapper="middlegen.plugins.hibernate.HibernateJavaTypeMapper"
    	 />
    	 <table name="achat" />
    	 <table name="actions" />
    	 <table name="compteimputation" />
    	 <table name="compterenduactivite" />
    	 <table name="coutjournalierexperian" />
    	 <table name="cratache" />
    	 <table name="depense" />
    	 <table name="droit" />
    	 <table name="facture" />
    	 <table name="frais" />
    	 <table name="intervcig" />
    	 <table name="intervenant" />
    	 <table name="notedefrais" />
    	 <table name="organisme" />
    	 <table name="postefacture" />
    	 <table name="projet" />
    	 <table name="tache" />
    	 <table name="tacheaction" />
    	 <table name="tachecommerciale" />
    	 <table name="tachetechnique" />
        </middlegen>
      </target>
     
      <target name="gen-java" depends="gen-hbm">
        <hbm2java output="${dest.dir}">
          <fileset dir="${dest.dir}">
            <include name="**/*.hbm.xml" />
          </fileset>
        </hbm2java>
      </target>
     
      <target name="compile" depends="gen-java">
      </target>
     
    merci
    </project>

  10. #10
    Membre confirmé
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    365
    Détails du profil
    Informations personnelles :
    Localisation : Maroc

    Informations forums :
    Inscription : Janvier 2006
    Messages : 365
    Points : 495
    Points
    495
    Par défaut
    Et le fichier de configuration où tu déclares les classes mappées, stp ?
    SCJP 5 / SCBCD 1.3 Certified

  11. #11
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2005
    Messages
    163
    Détails du profil
    Informations personnelles :
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Avril 2005
    Messages : 163
    Points : 86
    Points
    86
    Par défaut
    Salut,
    tu parles de hibernate.cfg.xml ?
    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
    <?xml version='1.0' encoding='utf-8'?>
    <!DOCTYPE hibernate-configuration PUBLIC 
    	"-//Hibernate/Hibernate Configuration DTD//EN"
    	"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
    <hibernate-configuration>
     
    	<session-factory>
     
    		<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
    		<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
    		<property name="connection.username">root</property>
    		<property name="connection.password"></property> 
    		<property name="connection.url">jdbc:mysql://localhost/bd_agp</property>
            <property name="show_sql">true</property>
     
    		<mapping resource="com/pia/agp/mapping/Achat.hbm.xml" />
    		<mapping resource="com/pia/agp/mapping/Action.hbm.xml" />
    		<mapping resource="com/pia/agp/mapping/Compteimputation.hbm.xml" />
    		<mapping resource="com/pia/agp/mapping/Compterenduactivite.hbm.xml" />
    		<mapping resource="com/pia/agp/mapping/Coutjournalierexperian.hbm.xml" />
    		<mapping resource="com/pia/agp/mapping/Cratache.hbm.xml" />
    		<mapping resource="com/pia/agp/mapping/Depense.hbm.xml" />
    		<mapping resource="com/pia/agp/mapping/Droit.hbm.xml" />
    		<mapping resource="com/pia/agp/mapping/Facture.hbm.xml" />
    		<mapping resource="com/pia/agp/mapping/Frai.hbm.xml" />
    		<mapping resource="com/pia/agp/mapping/Intervcig.hbm.xml" />
    		<mapping resource="com/pia/agp/mapping/Intervenant.hbm.xml" />
    		<mapping resource="com/pia/agp/mapping/Notedefrai.hbm.xml" />
    		<mapping resource="com/pia/agp/mapping/Organisme.hbm.xml" />
    		<mapping resource="com/pia/agp/mapping/Postefacture.hbm.xml" />
    		<mapping resource="com/pia/agp/mapping/Projet.hbm.xml" />
    		<mapping resource="com/pia/agp/mapping/Tache.hbm.xml" />
    		<mapping resource="com/pia/agp/mapping/Tacheaction.hbm.xml" />
    		<mapping resource="com/pia/agp/mapping/Tachecommerciale.hbm.xml" />
    		<mapping resource="com/pia/agp/mapping/Tachetechnique.hbm.xml" />
     
    	</session-factory>
    </hibernate-configuration>
    je crois que c'est celui là, c'est middelgen qui ma tous fais ,donc désolé si je te suis pas

  12. #12
    Membre confirmé
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    365
    Détails du profil
    Informations personnelles :
    Localisation : Maroc

    Informations forums :
    Inscription : Janvier 2006
    Messages : 365
    Points : 495
    Points
    495
    Par défaut
    Là en principe tout est bien. Est-ce que le problème viendrait de la configuration de Spring ? Tu peux nous montrer ton fichier de config spring ?
    SCJP 5 / SCBCD 1.3 Certified

  13. #13
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2005
    Messages
    163
    Détails du profil
    Informations personnelles :
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Avril 2005
    Messages : 163
    Points : 86
    Points
    86
    Par défaut
    Merci pour ta reponse,
    voila le fichier applicationContext.xml
    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
    <!DOCTYPE beans PUBLIC 	"-//SPRING//DTD BEAN//EN" 
    	"http://www.springframework.org/dtd/spring-beans.dtd">
     
    <beans>	
     
    	<bean id="dataSource" 
    		  class="org.springframework.jdbc.datasource.DriverManagerDataSource" >
    		<property name="driverClassName">
    			<value>com.mysql.jdbc.Driver</value>
    		</property>
    		<property name="url">
    			<value>jdbc:mysql://localhost/bd_agp</value>
    		</property>
    		<property name="username"><value>root</value></property>
    		<property name="password"><value></value></property>
    	</bean>
     
    	<bean id="sessionFactory"
    		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    		<property name="dataSource">
    			<ref local="dataSource"/>
    		</property>
    		<property name="mappingResources">
    		<list>
    			<value>com/pia/agp/mapping/Intervenant.hbm.xml</value>
    		</list>
    		</property>
    		<property name="hibernateProperties">
    			<props>
    				<prop key="hibernate.dialect">
    					org.hibernate.dialect.MySQLDialect
    				</prop>
    				<prop key="hbm2java">update</prop>
    			</props>
    		</property>
    	</bean>
     
    	<bean id="myTransactionManager"
            class="org.springframework.orm.hibernate3.HibernateTransactionManager">
           <property name="sessionFactory">
       		<ref local="sessionFactory"/>
    		</property>
        </bean>
     
        <bean id="hibernateInterceptor" class="org.springframework.orm.hibernate3.HibernateInterceptor">
             <property name="sessionFactory">
               <ref bean="sessionFactory"/>
             </property>
        </bean>    
     
      	<bean id="myIntervenantDao" class="com.pia.agp.dao.DaoIntervenantImpl">
    		<property name="sessionFactory"><ref local="sessionFactory"/></property>
    	</bean>
     
    	<bean id="service" class="com.pia.agp.service.ServiceIntervenantImpl" abstract="false" singleton="true" lazy-init="default" autowire="default" dependency-check="default">
    	<property name="dao">
      	<ref local="myIntervenantDao" /> 
      	</property>
      	</bean>
     
    </beans>
    et intervenant-servlet.xml
    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
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
    <beans>
    	<!-- les mappings de l'application -->
    	<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
    		<property name="mappings">
    			<props>
    				<prop key="/list.html">Intervenant.ListController</prop>
    				<prop key="/delete.html">Intervenant.DeleteController</prop>
    				<prop key="/edit.html">Intervenant.EditController</prop>
    				<prop key="/acceuil.html">Intervenant.AccueilController</prop>
    			</props>
    		</property>
    	</bean>
     
    	<bean name="openSessionInViewInterceptor"  
        class="org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor">
           <property name="sessionFactory"><ref bean="sessionFactory"/></property>
      	</bean>
     
    	<!-- LES CONTROLEURS -->
    	<bean id="Intervenant.ListController" 
    		class="com.pia.agp.web.ListIntervenant">
    		<property name="service">
    			<ref bean="service"/>
    		</property>
    	</bean>
    	<bean id="Intervenant.DeleteController" 
    		class="com.pia.agp.web.DeleteIntervenant">
    		<property name="service">
    			<ref bean="service"/>
    			<!--   <ref bean="Intervenant.DeleteController"/> -->
    		</property>
    	</bean>
    	<bean id="Intervenant.AccueilController" 
    		class="com.pia.agp.web.AcceuilIntervenant">
    		<property name="service">
    			<ref bean="service"/>
    		</property>
    	</bean>
     
    	<bean id="Intervenant.EditController" 
    		class="com.pia.agp.web.EditIntervenant">
    		<property name="sessionForm">
    			<value>true</value>
    		</property>
    		<property name="commandName">
    			<value>intervenant</value>
    		</property>
    		<property name="validator">
    			<ref bean="Intervenant.Validator"/>
    		</property>
    		<property name="formView">
    			<value>edit</value>
    		</property>
    		<property name="service">
    			<ref bean="service"/>
    		</property>
    	</bean>
    	<!-- le validateur -->
    	<bean id="Intervenant.Validator" 
    		class="com.pia.agp.web.ValidateIntervenant"/>
    	<!-- le résolveur de vues -->
    	<bean class="org.springframework.web.servlet.view.ResourceBundleViewResolver">
    		<property name="basename">
    			<value>vues</value>
    		</property>
    	</bean>
    	<!-- le gestionnaire d'exceptions 
    	<bean
    		class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
    		<property name="exceptionAttribute">
    			<value>exception</value>
    		</property>
    		<property name="defaultStatusCode">
    			<value>200</value>
    		</property>
    		<property name="defaultErrorView">
    			<value>exception</value>
    		</property>
    	</bean>
    	-->
    	<!-- le fichier des messages -->
    	<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
    		<property name="basename">
    			<value>messages</value>
    		</property>
    	</bean>
    </beans>
    merci bien

  14. #14
    Membre confirmé
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    365
    Détails du profil
    Informations personnelles :
    Localisation : Maroc

    Informations forums :
    Inscription : Janvier 2006
    Messages : 365
    Points : 495
    Points
    495
    Par défaut
    Voilà, c'était ça le problème. Le fichier de config spring applicationContext.xml doit lister toutes les classes mappées, et là en l'occurence il n'y a que la classe Intervenant qui est mappée, ce qui explique pourquoi les requêtes fonctionnent pour cette classe. Tu dois donc avoir ceci au niveau de mappingResources:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    <property name="mappingResources">
        <list>
    	<value>com/pia/agp/mapping/Intervenant.hbm.xml</value>
            <value>com/pia/agp/mapping/Droit.hbm.xml</value>
            ...
        </list>
    </property>
    Et ne pas oublier de faire autant pour toutes les autres classes mappées.
    SCJP 5 / SCBCD 1.3 Certified

  15. #15
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2005
    Messages
    163
    Détails du profil
    Informations personnelles :
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Avril 2005
    Messages : 163
    Points : 86
    Points
    86
    Par défaut
    oui moi aussi je viens de ramarquer ça ,il faudras que j'ajoute tous les hbm files ici.
    j'ai pas encore termine le test .
    je te tiens au courant
    merci bq

  16. #16
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2005
    Messages
    163
    Détails du profil
    Informations personnelles :
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations forums :
    Inscription : Avril 2005
    Messages : 163
    Points : 86
    Points
    86
    Par défaut
    Salut,
    désolé pour le retard j'avais d'autres exception qui sont survenues. Là ça marche super bien. Merci bq pour ton aide manblaizo c'est gentil de ta part.
    a la prochaine

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

Discussions similaires

  1. Formulaire depuis Tutoriel Spring MVC + JSTL
    Par c-bolo dans le forum Spring Web
    Réponses: 1
    Dernier message: 11/09/2010, 18h48
  2. Spring mvc (deux combo dépendant)
    Par santati dans le forum Spring Web
    Réponses: 0
    Dernier message: 28/05/2009, 15h20
  3. Réponses: 0
    Dernier message: 25/03/2009, 11h21
  4. [Spring MVC] Renvoyer vers une vue depuis un intercepteur
    Par ChtiGeeX dans le forum Spring Web
    Réponses: 2
    Dernier message: 01/04/2007, 10h26
  5. [Spring MVC] Remplissage d'un combo box depuis ma BD
    Par iftolotfi dans le forum Spring Web
    Réponses: 7
    Dernier message: 08/07/2006, 00h54

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