Bonjour, je me décide à me mettre à Hibernate avec Spring mais voila que j'ai une erreur dès le début.
Erreur: "Could not parse mapping document from invalid mapping"
Mon fichier de mapping: Enduro.hbm
Code xml : 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 <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" > <hibernate-mapping package="com.enduro.entites"> <class name="Enduro" table="enduro"> <property column="poids" length="20" name="poids" not-null="false" type="string" /> </class> </hibernate-mapping>
Mon fichier spring-config.xml
Code xml : 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 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <!-- la source de donnéees DBCP --> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName"> <value>com.mysql.jdbc.Driver</value> </property> <property name="url"> <value>jdbc:mysql://localhost/enduro_db</value> </property> <property name="username"> <value>root</value> </property> <property name="password"> <value></value> </property> </bean> <!-- sessionFactory --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref local="dataSource"/> </property> <property name="mappingResources"> <list> <value>Enduro.hbm</value> </list> </property> </bean> <!-- la classes d'accès à la couche [dao] --> <bean id="daoEnduro" class="com.enduro.dao.DaoEnduro"> <property name="sessionFactory"> <ref local="sessionFactory"/> </property> </bean> <!-- la classe serviceEnduro --> <bean id="serviceEnduro" class="com.enduro.service.ServiceEnduro"> <property name="daoEnduro"> <ref local="daoEnduro" /> </property> </bean> </beans>
Ma classe Enduro
Code java : 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 package com.enduro.entites; import java.lang.String; public class Enduro { private String poids; public Enduro() { } public String getPoids() { return poids; } public void setPoids(String poids) { this.poids = poids; } }
J'attends vos réponse avec une très grande impatience !!
Merci beaucoup
Partager