-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: [Résolu] PB en creation de la session factory
PostPosted: Mon Feb 06, 2006 6:07 am 
Newbie

Joined: Fri Feb 03, 2006 10:03 am
Posts: 2
Hibernate version:
3.1 on MySQL 4.1 & JDK 5.0


Bonjour,

j'utilise une gestion externe pour mes clé composées.

j'ai donc un objet "TariffId" pour clé de mon objet mappé "Tariff".

Code:
<?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="Tariff" table="TARIFF" catalog="maBDD">
        <composite-id name="id" class="TariffId">
            <key-property name="idtariff" type="short" column="idtariff" />
            <key-property name="identerprise" type="integer" column="identerprise"/>
        </composite-id>
        <property name="libtariff" type="string">
            <column name="libtariff" length="25" />
        </property>
        <property name="typtariff" type="short">
            <column name="typtariff" />
        </property>
    </class>
</hibernate-mapping>


Tous les objets sont dans le même package.
Les fichiers de mapping sont dans un dossier à part
or a la création de ma sessionfactory il charge bien tous les objet mappé et me sort cette exception sur mon "ID"

Code:
DEBUG [Configuration] sessionA_M<-org.dom4j.tree.DefaultAttribute@1bfc93a [Attribute: name resource value "hibernateMapping/Tariff.hbm.xml"]
INFO  [Configuration] Reading mappings from resource: hibernateMapping/Tariff.hbm.xml
DEBUG [DTDEntityResolver] trying to locate http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath under org/hibernate/
DEBUG [DTDEntityResolver] found http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd in classpath
INFO  [HbmBinder] Mapping class: Tariff -> TARIFF
DEBUG [HbmBinder] Mapped property: idtariff -> idtariff
DEBUG [HbmBinder] Mapped property: identerprise -> identerprise
DEBUG [HbmBinder] Mapped property: id -> idtariff, identerprise
DEBUG [HbmBinder] Mapped property: libtariff -> libtariff
DEBUG [HbmBinder] Mapped property: typtariff -> typtariff
....
DEBUG [Configuration] resolving reference to class: Tariff
....
Exception in thread "Thread-0" java.lang.ExceptionInInitializerError
   at clientserver.ServerRMI.run(ServerRMI.java:54)
Caused by: java.lang.RuntimeException: Problème de configuration : component class not found: TariffId
   at datacontrol.HibernateUtil.<clinit>(HibernateUtil.java:26)
   ... 1 more
Caused by: org.hibernate.MappingException: component class not found: TariffId
   at org.hibernate.mapping.Component.getComponentClass(Component.java:105)
   at org.hibernate.tuple.PojoComponentTuplizer.buildGetter(PojoComponentTuplizer.java:140)
   at org.hibernate.tuple.AbstractComponentTuplizer.<init>(AbstractComponentTuplizer.java:79)
   at org.hibernate.tuple.PojoComponentTuplizer.<init>(PojoComponentTuplizer.java:33)
   at org.hibernate.tuple.TuplizerLookup.create(TuplizerLookup.java:126)
   at org.hibernate.mapping.Component.getType(Component.java:160)
   at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253)
   at org.hibernate.mapping.RootClass.validate(RootClass.java:193)
   at org.hibernate.cfg.Configuration.validate(Configuration.java:983)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1147)
   at datacontrol.HibernateUtil.<clinit>(HibernateUtil.java:24)
   ... 1 more
Caused by: java.lang.ClassNotFoundException: TariffId
   at java.net.URLClassLoader$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClassInternal(Unknown Source)
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Unknown Source)
   at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:108)
   at org.hibernate.mapping.Component.getComponentClass(Component.java:102)
   ... 11 more

j'ai un peu épuré le log pour gardé l'essentiel.

Mon HibernateUtil.java est l'original donné par cette excellente Doc Hibernate.

Merci.


Last edited by kobayashi on Mon Feb 06, 2006 6:45 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 06, 2006 6:43 am 
Newbie

Joined: Fri Feb 03, 2006 10:03 am
Posts: 2
C'est bon j'ai trouvé....

Comme quoi rien ne sert de courir.

j'ai pas bien précisé le chemin de la class dans le fichier hbm.

A savoir que dans ce cas (les fichier de mapping ne sont pas dans le meme dossier que les objet eux même) il faut preciser le package sur la balise

<hibernate-mapping package="monPackage">




En tous cas merci pour ce bijou de technologie!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.