Hi
I am working on a simple Hibernate One to One Mapping Application .
For this i created two Tables Car and Registration as shown :
Car and Registration number are basically related to each other as one to one, that means for a single car, there could be at most a single registration number, and vice versa.
create table Car(car_name varchar2(20),car_model varchar2(50),primary key(car_name))
create table Registration(registration_number varchar(20),car_name varchar(20) not null, primary key(registration_number),unique(car_name))
Made car_name as Unique , so to have one to One mapping .
By
IDE Reverseengineering i got these hbm files
This is for Car
This is for Registration :
Please tell me is this mapping correct because i have a seen a example in a site of One to One Hibernate where the author uses
<many-to-one> inside the hbm file .
Please let me know .