Message from discussion OneToOne relationship? (was Re: Retrieving an object based upon a composed relationship)
Received: by 10.214.243.4 with SMTP id q4mr9219696qah.14.1220362545044;
Tue, 02 Sep 2008 06:35:45 -0700 (PDT)
Received: from mail-gx0-f19.google.com (mail-gx0-f19.google.com [184.108.40.206])
by mx.google.com with ESMTP id 22si12625650yxr.1.2008.09.02.06.35.44;
Tue, 02 Sep 2008 06:35:45 -0700 (PDT)
Received-SPF: pass (google.com: domain of armchairde...@gmail.com designates 220.127.116.11 as permitted sender) client-ip=18.104.22.168;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of armchairde...@gmail.com designates 22.214.171.124 as permitted sender) smtp.mail=armchairde...@gmail.com; dkim=pass (test mode) header...@gmail.com
Received: by mail-gx0-f19.google.com with SMTP id 12so5176765gxk.21
for <email@example.com>; Tue, 02 Sep 2008 06:35:44 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
DomainKey-Signature: a=rsa-sha1; c=nofws;
Received: by 10.150.143.5 with SMTP id q5mr3763179ybd.90.1220362544460;
Tue, 02 Sep 2008 06:35:44 -0700 (PDT)
Received: from ?10.0.1.199? ( [126.96.36.199])
by mx.google.com with ESMTPS id s35sm11501951qbs.13.2008.09.02.06.35.42
Tue, 02 Sep 2008 06:35:43 -0700 (PDT)
Mime-Version: 1.0 (Apple Message framework v753.1)
References: <84eb8a50809020515j64c3cd34ye8c5b9bb68813...@mail.gmail.com> <8c65a88f0809020624v282ee2a3ydd50005cffc1b...@mail.gmail.com>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
From: Jared Rypka-Hauer <armchairde...@gmail.com>
Subject: Re: [transfer-dev] Re: OneToOne relationship? (was Re: Retrieving an object based upon a composed relationship)
Date: Tue, 2 Sep 2008 08:33:46 -0500
X-Mailer: Apple Mail (2.753.1)
I think there's more to it than just the diversion of resources...
one2one is considered an edge case because it's not particularly good
DB design... if you have a one2one join, you should consider putting
the data together in the same table. Since supporting questionable DB
design isn't within Transfer's charter, it's a question of Mark's
time being spent on supporting something that shouldn't really be
necessary in the first place or working on any of the bajillions of
other enhancements or bug fixes that are essential.
Meanwhile, by means of a one2many on the 1:1 tables, you can achieve
what's essentially the same behavior (or at least similar) insofar as
getters and setters are concerned. Since a one2one is the same as a
one2many with the one minor difference that the joining table will
only ever have one related row, there's no particular reason not to
go ahead and use it. If you want to enforce the 1:1 nature of the
tables, just create a decorator, override the generated setFoo()
method to indicate your preferred behavior (throw error? overwrite
original record? backup record then overwrite?).
I guess that brings up yet another point against this... what's the
desired behavior when calling Bar.setFoo(Foo) on a 1:1 relationship?
There's too many viable options in this case to have consistent and
acceptable results. So we're back to using a one2many and overriding
the generated methods in a decorator. If you have a one2one
relationship, this is not just your only option but quite possibly
the most elegant option available.
On Sep 2, 2008, at 8:24 AM, Bob Silverberg wrote:
> This has been discussed a few times before. I know that I have asked
> this question at least twice, and the response has always been that
> one2one represents an edge case, and that the resources required to
> implement it could be used elsewhere to greater benefit. At least
> that was the way I interpreted the response.
> I didn't agree with this, not entirely anyway, as I have used one2one
> on numerous occasions, but that was just my opinion. If anyone else
> sees this as a valuable enhancement please speak up, and maybe it can
> get added as an enhancement request.