A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Object Relational Mapping
Hbm files generated for One to One Mapping
Ravi Kiran Va
Joined: Apr 18, 2009
Dec 15, 2009 09:23:11
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 .
create table Car (
CarName Varchar2(20) primary key,
create table Registration (
RegNumber Varchar2(20) primary key,
CarName Varchar2(20) unique,
FOREIGN KEY (CarName)
HBM Files :
<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 .
Save India From Corruption - Anna Hazare.
Joined: Dec 14, 2009
Dec 15, 2009 10:04:40
Please look in below link, you will get useful information
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
subject: Hbm files generated for One to One Mapping
Hibernate mapping doubt
Hibernate One to One Example
Replacing *.hbm.xml files with @Annotations.
How to achieve One to One mapping between two tables
Hibernate - Creating .hbm file for link table
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013