Hi,

  I was thinking about 1:1 relations and was wondering how it could be
implemented. I settled on the conclusion that a true 1:1 relation can't
be defined in a DB. Now I see Thomas has the same conclusion too - so
one of my doubts have been cleared.

My other doubt is, if it's a 1:1 relation between 2 tables, why not
simply merge them? What's the point in having 2 tables with 1:1
relations.

Isn't having 2 1:1 related tables like having one table for name and one
table for address, both having, say SSN, as the primary key? We would
never do the above example, then why have 2 tables with 1:1 relations?

Thanks,
Sarav
P.S: Sorry about the slightly unrelated topic. Also, I notice that there
have been no bug report for my Village-Oracle patch! Me happy!

On Wed, 2004-12-08 at 09:22, Vitzethum, Daniel wrote:
> Hi Thomas,
> 
> > I am not sure if I understand the question.
> 
> you did ;-)
> 
> > (...)
> > If you have a real 1:1 behaviour, you can put the foreign key on the
> > other side, ...
> 
> Indeed it is a 1:1 thing. So it would be possible to switch the FK's
> location. But then I'd lose the information in my  "n" table if there
> is something associated or not (FK = null).
> 
> > If you do not have too many  relations of this sort, a solution would
> > be to override the save(..) methods in the persistent Objects.
> 
> I choose that one! My solution, worked fine on first try:
> 
> Overriding save(Connection):
> ---snip---
> public void save(Connection con) throws TorqueException {
>   if (getOtherObject() != null) {
>     getOtherObject().save(con);
>     setFkOtherObjectId(getOtherObject().getOtherObjectId());
>   }
>   super.save(con);
> }
> ---snip---
> 
> 
> Thank you!
> 
> Daniel
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to