Bonjour !
Je suis confronté à quelques difficultés lors de réalisation de mon premier projet avec Hibernate. Le message d'erreur est le suivant :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
Could not parse mapping document from resource ddd/pharaon/Vehicule.hbm.xml
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
<?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="connection.datasource">
           java:comp/env/jdbc/GestionParc
        </property>
        <property name="show_sql">true</property>
        <property name="dialect">
              net.sf.hibernate.dialect.SQLServerDialect
        </property>
        <! Mapping files >
        <mapping resource="Vehicule.hbm.xml"/>
    </session-factory>
</hibernate-configuration>
Vehicule.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
<?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="ddd.pharaon">
    <class name="Vehicule" table="T_Vehicule">
        <! l'ID de la table. >
        <id name="idVehicule" type="int" column="idVehicule" unsaved-value="0">
            <generator class="identity"/>
        </id>
        <! le num >
        <property name="numVehicule">
            <column name="numVehicule" length="55" not-null="true"/>
        </property>
        <! l'Immatriculation >
        <property name="immatriculation">
            <column name="Immatriculation" length="55" not-null="true"/>
        </property>
    </class>
</hibernate-mapping>
Bean Vehicule
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
 
 
public class Vehicule {
 
  private int idVehicule ;
  private String numVehicule ;
  private String immatriculation ;    
    /** Creates a new instance of Vehicule */
    public Vehicule() {
    }
 
    public int getIdVehicule(){
        return idVehicule;
    }
    public void setIdVehicule(int value){
        idVehicule = value;
    }
    public String getNumVehicule(){
        return numVehicule;
    }
    public void setNumVehicule(String value){
        numVehicule = value;
    }
    public String getImmatriculation(){
        return immatriculation;
    }
    public void setImmatriculation(String value){
        immatriculation = value;
    }   
 
}