-->
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.  [ 1 post ] 
Author Message
 Post subject: Hbm files generated for One to One Mapping
PostPosted: Tue Dec 15, 2009 12:27 pm 
Newbie

Joined: Sat Dec 12, 2009 2:25 am
Posts: 3
Hi

I am trying to do establish a One to One Mapping between These two Tables Car and Registrion .

So i added a Unique Constriant on to the foreign Key .

But When i generated hbm files for these two tables it still has a Many to One mapping .


Tables :

create table Car (
CarName Varchar2(20) primary key,
CarModel Varchar2(20)
)

create table Registration (
RegNumber Varchar2(20) primary key,
CarName Varchar2(20) unique,
FOREIGN KEY (CarName)
REFERENCES Car(CarName)

)



HBM Files :
Code:
Registration.xml :
<hibernate-mapping>
    <class name="MYPACK.Registration" table="REGISTRATION" schema="CHENNAISPAT">
        <id name="regnumber" type="java.lang.String">
            <column name="REGNUMBER" length="20" />
            <generator class="assigned" />
        </id>
        <many-to-one name="car" class="MYPACK.Car" fetch="select">
            <column name="CARNAME" length="20" />
        </many-to-one>
    </class>
</hibernate-mapping>


Please tell me where i am doing wrong .


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

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.