Slt,
G un soucis sans doute avec un hbm.
J'utilise middlegen pr generer les hbm ainsi que les classes java.
Aucun pb pr les tables avec un clef primaire simple, ainsi que pr les relations many to one et one to many.
Les classes générées sont parfaitement exploitables.
En revanche cela ne fonctionne pas pr les classes générées à partir de hbm construit à partir de tables ayant une clef composite.
Voici le hbm
Code:
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>
<!--
Created by the Middlegen Hibernate plugin 2.2
http://boss.bekk.no/boss/middlegen/
http://www.hibernate.org/
-->
<class
name="hibernate_mapping.TAsso"
table="t_assos"
lazy="false"
>
<meta attribute="implement-equals" inherit="false">true</meta>
<composite-id name="comp_id" class="hibernate_mapping.TAssoPK">
<key-property
name="idContact"
column="id_contact"
type="java.lang.Integer"
length="10"
/>
<key-property
name="idMetier"
column="id_metier"
type="java.lang.Integer"
length="10"
/>
</composite-id>
</class>
</hibernate-mapping>
L'erreur à l'execution est la suivante
Quote:
INFO: building session factory
java.lang.ExceptionInInitializerError
at Test.main(Test.java:53)
Caused by: java.lang.RuntimeException: Problème de configuration : Bad identifier type: net.sf.hibernate.type.ComponentType
at com.minosis.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:15)
... 1 more
Caused by: net.sf.hibernate.MappingException: Bad identifier type: net.sf.hibernate.type.ComponentType
at net.sf.hibernate.persister.AbstractEntityPersister.<init>(AbstractEntityPersister.java:660)
at net.sf.hibernate.persister.EntityPersister.<init>(EntityPersister.java:716)
at net.sf.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:42)
at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:136)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:791)
at com.minosis.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:13)
... 1 more
Exception in thread "main"
Je suppose que le hbm généré à des soucis ms pourriez vous m'indiquer lesquels ? Merki