Hi All,
Last time I am trying to solve one problem.
So:
I have one table "body", which is associate to two hands. Left hand, and right hand.
I tried to do it by using <one-to-one> associaton.
Classes are looks like:
Code:
class Hand
{
Long handId;
//Other attributes, getters and setters
}
class Body
{
Long bodyId;
Hand leftHand;
Hand rightHand;
//Other attributes, getters and setters
}
DB schema is looks like:
Code:
TABLE BODY,
"BODY_ID" NUMBER(19,0) NOT NULL ENABLE,
"LEFT_HAND_ID" NUMBER(19,0) NOT NULL DISABLE,
"RIGHT_HAND_ID" NUMBER(19,0) NOT NULL DISABLE,
PRIMARY KEY "BODY_ID";
TABLE HAND,
"HAND_ID" NUMBER(19,0) NOT NULL ENABLE,
PRIMARY KEY(HAND_ID);
In hbm's I'm using sequence generators to each id.
Now everything is working on <many-to-one> associations, but I want to use <one-to-one>.
Is there any possibilities to use <one-to-one> ?
How can I do it?
p.s.That example is simple representation of my problem in big application.