Joined: Mon Oct 24, 2005 9:16 am Posts: 6
|
I am using Eclipse to generate Hibernate mappings from an Oracle 9 database.
I have two tables
INSTRUMENT (primary key is id) and OBJET (primary key is id)
INSTRUMENT.id is also foreign key to OBJET.id.
When I generate a mapping , below is what i get.
The mapping for foreign key is not generated and i don't know how to complete the mapping in order to save on cascade an objet and then an instrument too.
I have made no modifications to the default hibernate xml files generated by Eclipse using Hibernate Artifact Generator.
Thanks for help.
INSTRUMENT
long id - PK;
Commentaire commentaire;
String typeInstrument;
Date dtCreation;
PERSON
long id - PK;
TypeObjet typeObjet;
String libelle;
<!--MAPPING FILES -->
OBJET
------------
<class name="Objet" table="OBJET" >
<id name="id" type="long">
<column name="ID" />
<generator class="assigned"/>
</id>
<many-to-one name="typeObjet" class="TypeObjet">
<column name="ID_TYPE_OBJET" precision="22" scale="0" />
</many-to-one>
<property name="libelle" type="string" unique="false" update="true" >
<column name="LIBELLE" length="32" not-null="true" />
</property>
</class>
</hibernate-mapping>
INSTRUMENT
-------------------
<class name="Instrument" table="INSTRUMENT" >
<id name="id" type="long">
<column name="ID" />
<generator class="assigned"/>
</id>
<many-to-one name="commentaire" class="Commentaire" >
<column name="ID_COMMENTAIRE" precision="22" scale="0" />
</many-to-one>
<property name="typeInstrument" type="string" >
<column name="TYPE_INSTRUMENT" length="1" />
</property>
<property name="dtCreation" type="timestamp" >
<column name="DT_CREATION" length="7" />
</property>
</class>
</hibernate-mapping>
|
|