Bonjour,

J'ai un problème avec Hibernate que je ne comprends pas.

J'exécute mon application à partir d'Eclipse et voici l'erreur que j'obtiens :
11 avr. 2010 00:49:26 net.sf.hibernate.cfg.Environment <clinit>
INFO: Hibernate 2.1.6
11 avr. 2010 00:49:26 net.sf.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
11 avr. 2010 00:49:26 net.sf.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
11 avr. 2010 00:49:26 net.sf.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
11 avr. 2010 00:49:26 net.sf.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
11 avr. 2010 00:49:26 net.sf.hibernate.cfg.Configuration addResource
INFO: Mapping resource: Abonne.hbm
11 avr. 2010 00:49:26 net.sf.hibernate.util.XMLHelper$ErrorLogger error
GRAVE: Error parsing XML: XML InputStream(10) Attribute "sql_type" must be declared for element type "column".
Exception in thread "main" java.lang.ExceptionInInitializerError
Fichier hibernate.cfg.xml générée:
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
?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration
    PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
 
<hibernate-configuration>
    <session-factory >
        <!-- local connection properties -->
        <property name="hibernate.connection.url">jdbc:mysql://localhost/BIBLIO</property>
        <property name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</property>
        <property name="hibernate.connection.username">root</property>
        <property name="hibernate.connection.password">omarkhedher</property>
        <!-- property name="hibernate.connection.pool_size"></property -->
 
        <!-- dialect for MySQL -->
        <property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
 
        <property name="hibernate.show_sql">false</property>
        <property name="hibernate.use_outer_join">true</property>
        <property name="hibernate.transaction.factory_class">net.sf.hibernate.transaction.JTATransactionFactory</property>
        <property name="jta.UserTransaction">java:comp/UserTransaction</property>
        <mapping resource="Abonne.hbm" />
    </session-factory>
</hibernate-configuration>
Fichier Abonne.hbm:

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//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
 
<hibernate-mapping>
    <class name="com.minosis.hibernate.Abonne" table="Abonne">
 
        <id name="Num_AB" type="integer">
        <column name="id" sql_type="int(4)"/>
        <generator class="increment" />
        </id>
 
        <property name="Nom" type="string">
        <column name="NOM" sql-type="char(30)" not-null="true"/>
        </property>
 
        <property name="Age" type="integer">
        <column name="AGE" sql-type="int(4)" not-null="false" />
        </property>
 
        <property name="Prenom" type="string">
        <column name="PRENOM" sql-type="char(30)" not-null="false"/>
        </property>
 
        <property name="VILLE" type="string">
        <column name="Ville" sql-type="char(30)" not-null="false"/>
        </property>
 
 
        <property name="Tarif" type="integer">
        <column name="TARIF" sql-type="int(4)" not-null="false" />
        </property>
 
        <property name="Reduc" type="integer">
        <column name="REDUC" sql-type="int(4)" not-null="false" />
        </property>
 
    </class>
</hibernate-mapping>
Ce que je vois est qu'il y a un problème de lecture du fichier de configuration, alors que j'ai testé la validité du fichier XML généré (hibernate.cfg.xml) avec XMLspy et je ne trouve pas où est l'erreur...

Merci pour aide ....