Reputation: 23
I am new to Hibernate. I have an exception in my Hibernate project, I think it due to my Lecteurs.hbm.xml file.
I need your help please. thanks.
The exception is as follows:
958 [main] ERROR org.hibernate.util.XMLHelper - Error parsing XML: XML InputStream(13) need whitespace between attributes
Initial SessionFactory creation failed.org.hibernate.InvalidMappingException: Could not parse mapping document from resource bean/Lecteurs.hbm.xml
Exception in thread "main" java.lang.ExceptionInInitializerError
at util.HibernateUtil.<clinit>(HibernateUtil.java:21)
at manager.LecteursManager.ajouterLecteur(LecteursManager.java:13)
at test.Test_Main.main(Test_Main.java:18)
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from resource bean/Lecteurs.hbm.xml
at org.hibernate.cfg.Configuration.addResource(Configuration.java:616)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1635)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1603)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1582)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1556)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1476)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1462)
at util.HibernateUtil.<clinit>(HibernateUtil.java:15)
... 2 more
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from input stream
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:555)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:613)
... 9 more
Caused by: org.dom4j.DocumentException: Error on line 13 of document : need whitespace between attributes Nested exception: need whitespace between attributes
at org.dom4j.io.SAXReader.read(SAXReader.java:482)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:546)
... 10 more
Below is the mappings file Lecteurs.hbm.xml
<?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 >
<class name="bean.Lecteurs" table="LECTEURS">
<id name="id" type="int" column="ID" >
<generator class="increment"/>
</id>
<property name="nom_lecteur" type="string" column="nomLecteur" />
<property name="prenom_lecteur"" type="string" column="prenomLecteur" />
<property name="date_naissance" type="Date" column="dateNaissance" />
<property name="email_lecteur" column="emailLecteur" ></property>
<property name="telephone" column="telephoneLecteur" ></property>
<property name="adresse" column="adresseLecteur" ></property>
</class>
</hibernate-mapping>
Upvotes: 2
Views: 1025
Reputation: 8877
You have a two double quotes in a row in this line which could cause that error:
<property name="prenom_lecteur"" type="string" column="prenomLecteur" />
Upvotes: 2