-->
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: Hibernate one-to-one mapping problem
PostPosted: Fri Nov 11, 2005 7:10 pm 
Newbie

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>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 11, 2005 7:16 pm 
Newbie

Joined: Mon Oct 24, 2005 9:16 am
Posts: 6
I have made a mistake the name of the Table is OBJET instead of PERSON


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.