[hibernate + eclipse] probleme de mapping et de compilation

probleme de mapping et de compilation [hibernate + eclipse] - Java - Programmation

Marsh Posté le 23-11-2005 à 10:54:26    

Bonjour,  
j'ai un soucis lors de la compilation d'un projet avec hibernate  
voila les erreurs console que me renvoie eclipse  
 
22 nov. 2005 16:04:03 net.sf.hibernate.cfg.Environment <clinit>  
INFO: Hibernate 2.1.6  
22 nov. 2005 16:04:03 net.sf.hibernate.cfg.Environment <clinit>  
INFO: hibernate.properties not found  
22 nov. 2005 16:04:03 net.sf.hibernate.cfg.Environment <clinit>  
INFO: using CGLIB reflection optimizer  
22 nov. 2005 16:04:03 net.sf.hibernate.cfg.Configuration configure  
INFO: configuring from resource: /hibernate.cfg.xml  
22 nov. 2005 16:04:03 net.sf.hibernate.cfg.Configuration getConfigurationInputStream  
INFO: Configuration resource: /hibernate.cfg.xml  
22 nov. 2005 16:04:03 net.sf.hibernate.cfg.Configuration addResource  
INFO: Mapping resource: hibernate/mapping/Chanson.hbm  
22 nov. 2005 16:04:03 net.sf.hibernate.cfg.Binder bindRootClass  
INFO: Mapping class: traitement.Chanson -> chanson  
22 nov. 2005 16:04:03 net.sf.hibernate.cfg.Configuration addResource  
INFO: Mapping resource: hibernate/mapping/Distributeur.hbm  
22 nov. 2005 16:04:03 net.sf.hibernate.cfg.Binder bindRootClass  
INFO: Mapping class: traitement.Distributeur -> distributeur  
22 nov. 2005 16:04:03 net.sf.hibernate.cfg.Configuration addResource  
INFO: Mapping resource: hibernate/mapping/Genre.hbm  
22 nov. 2005 16:04:03 net.sf.hibernate.cfg.Binder bindRootClass  
INFO: Mapping class: traitement.Genre -> genre  
22 nov. 2005 16:04:03 net.sf.hibernate.cfg.Binder bindCollection  
INFO: Mapping collection: traitement.Genre.oeuvre -> typer  
22 nov. 2005 16:04:03 net.sf.hibernate.cfg.Configuration addResource  
INFO: Mapping resource: hibernate/mapping/Langue.hbm  
22 nov. 2005 16:04:04 net.sf.hibernate.cfg.Binder bindRootClass  
INFO: Mapping class: traitement.Langue -> langue  
22 nov. 2005 16:04:04 net.sf.hibernate.cfg.Binder bindCollection  
INFO: Mapping collection: traitement.Langue.film -> version  
22 nov. 2005 16:04:04 net.sf.hibernate.cfg.Configuration addResource  
INFO: Mapping resource: hibernate/mapping/Oeuvre.hbm  
22 nov. 2005 16:04:04 net.sf.hibernate.util.XMLHelper$ErrorLogger error  
GRAVE: Error parsing XML: XML InputStream(3 Lattribut "{0}" nest pas déclaré pour lélément "{1}".  
22 nov. 2005 16:04:04 net.sf.hibernate.util.XMLHelper$ErrorLogger error  
GRAVE: Error parsing XML: XML InputStream(53) Lélément "{0}" naccepte pas "one-to-one" ici.  
22 nov. 2005 16:04:04 net.sf.hibernate.util.XMLHelper$ErrorLogger error  
GRAVE: Error parsing XML: XML InputStream(53) La valeur dattribut pour "{0}" est #REQUIRED.  
22 nov. 2005 16:04:04 net.sf.hibernate.util.XMLHelper$ErrorLogger error  
GRAVE: Error parsing XML: XML InputStream(54) Lélément "{0}" nécessite des éléments additionnels.  
java.lang.ExceptionInInitializerError  
at ihm.Start.main(Start.java:46)  
Caused by: java.lang.RuntimeException: Problème de configuration : Error reading resource: hibernate/mapping/Oeuvre.hbm  
at traitement.HibernateUtil.<clinit>(HibernateUtil.java:16)  
... 1 more  
Caused by: net.sf.hibernate.MappingException: Error reading resource: hibernate/mapping/Oeuvre.hbm  
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:339)  
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:1013)  
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:969)  
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:897)  
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:883)  
at traitement.HibernateUtil.<clinit>(HibernateUtil.java:14)  
... 1 more  
Caused by: net.sf.hibernate.MappingException: invalid mapping  
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:287)  
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:336)  
... 6 more  
Caused by: org.xml.sax.SAXParseException: Lattribut "{0}" nest pas déclaré pour lélément "{1}".  
at org.apache.crimson.parser.Parser2.error(Unknown Source)  
at org.apache.crimson.parser.Parser2.maybeElement(Unknown Source)  
at org.apache.crimson.parser.Parser2.content(Unknown Source)  
at org.apache.crimson.parser.Parser2.maybeElement(Unknown Source)  
at org.apache.crimson.parser.Parser2.content(Unknown Source)  
at org.apache.crimson.parser.Parser2.maybeElement(Unknown Source)  
at org.apache.crimson.parser.Parser2.parseInternal(Unknown Source)  
at org.apache.crimson.parser.Parser2.parse(Unknown Source)  
at org.apache.crimson.parser.XMLReaderImpl.parse(Unknown Source)  
at org.dom4j.io.SAXReader.read(SAXReader.java:339)  
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:286)  
... 7 more  
Exception in thread "main"  
 
je vous donne aussi le mapping de ma classe oeuvre  
 
<?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="traitement">  
<class name="Oeuvre" table="oeuvre">  
<id  
column="idoeu"  
name="idOeu"  
type="java.lang.Short"  
>  
<generator class="vm" />  
</id>  
<property  
column="annee"  
length="10"  
name="annoeu"  
not-null="false"  
type="date"  
/>  
<property  
column="titreoeu"  
length="60"  
name="titreOeu"  
not-null="false"  
type="string"  
/>  
<property  
column="imaoeu"  
length="30"  
name="imaOeu"  
not-null="false"  
type="string"  
/>  
<one-to-one  
class="traitement.Distributeur"  
name="distributeur"  
column="iddist"/>  
<set name="genre" table="typer">  
<key column="typoeu" />  
<many-to-many class="traitement.Genre"/>  
</set>  
<set name="nationnalite" table="nationnalite">  
<key column="natoeu" />  
<many-to-many class="traitement.Pays"/>  
</set>  
<set name="support" table="stocker">  
<key column="stockoeu" />  
<many-to-many class="traitement.Support"/>  
</set>  
<set name="emprunteur" table="emprunt">  
<key column="empoeu" />  
<one-to-one class="traitement.User"/>  
</set>  
 
<!-- MAPPING CLASSE FILLE -->  
<!-- mapping classe Film -->  
<subclass name="Film" >  
<property name="idFilm" column="idfilm" type="java.lang.Short"/>  
<property column="resfilm" name="resumeFilm" not-null="false"  
type="string" />  
<set name="acteur" table="jouer">  
<key column="jouefilm" />  
<many-to-many class="traitement.Personne"/>  
</set>  
<set name="realisateur" table="realiser">  
<key column="reafilm" />  
<many-to-many class="traitement.Personne"/>  
</set>  
<set name="langue" table="version">  
<key column="versfilm" />  
<many-to-many class="traitement.Langue"/>  
</set>  
<set name="st" table="soustitre">  
<key column="stfilm" />  
<many-to-many class="traitement.Langue"/>  
</set>  
</subclass>  
 
<!-- mapping classe Music -->  
<subclass name="Music" >  
<property name="idMusic" column="idmusic" type="java.lang.Short"/>  
<property column="nbmusic" length="3" name="nbChans"  
not-null="false"  
type="java.lang.Byte" />  
<set name="chanson" cascade="all-delete-orphan">  
<key column="idchans"/>  
<one-to-many class="traitement.Chanson" />  
</set>  
<set name="interprete" table="interpreter">  
<key column="intermusic" />  
<many-to-many class="traitement.Personne"/>  
</set>  
<set name="compositeur" table="composer">  
<key column="compmusic" />  
<many-to-many class="traitement.Personne"/>  
</set>  
</subclass>  
 
<!-- mapping classe Livre -->  
<subclass name="Livre" >  
<property name="idLivre" column="idlivre" type="java.lang.Short"/>  
<property column="reslivre" name="resumeLivre" not-null="false"  
type="string" />  
<set name="ecrivain" table="ecrire">  
<key column="ecrilivre" />  
<many-to-many class="traitement.Personne"/>  
</set>  
<many-to-one  
class="traitement.Langue"  
name="langue"  
column="codlang"/>  
</subclass>  
 
</class>  
</hibernate-mapping>  
 
je pense que cela vient du mapping par classe fille, j'intègre lorsque je déclare les sub-class des liens vers d'autres classes qui ne sont pas en corélation directe avec la c lasse Oeuvre.  
 
voila, merci pour vos réponses

Reply

Marsh Posté le 23-11-2005 à 10:54:26   

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed