I don't think it is referential integrity. It is a one-to-one were
sometimes the other side of the relationship may not exist.
A non existant row is normal in many situations and handled easily in
sql with a left join.
Catching the exception is a bit more code but not really a problem and
seems to work well as when there is not a record found I want to replace
it with other data anyway.
Thanks for the help.
-----Original Message-----
From: Andrus Adamchik [mailto:andru..bjectstyle.org]
Sent: Wednesday, 1 September 2004 11:18 PM
To: cayenne-use..bjectstyle.org
Subject: Re: Left joins
When resolving to-one relationships, Cayenne returns null if there is
no target row for the FK, so normally no outer joins are required. The
behavior that you describe is possible if you have referential
integrity problems (i.e. you have FK pointing to a non-existent row).
Then catching the exception is appropriate, as it is not a normal
situation.
If this is NOT the case, that I need to know how your relationship is
mapped, so either send me a DataMap directly, or open a bug report and
attach it to the ticket. In both cases, post a stack trace.
Thanks
Andrus
On Aug 31, 2004, at 10:54 PM, Lindsay Steele wrote:
> All the other stuff is now working well .. thanks for all the help.
>
> I have searched the mailing list archives on gmane and can't seem to
> find and answer for this one. Gmane is doing strange
> things with my searches too ... are there any other searchable
> archives of the mailing list ??
>
> I am just wondering if there is anything like a left join.
>
> I am using the following line.
>
> "call.getToExtension().getToDepartment().getDepartmentName()"
>
> The extension does not exist .. but that is ok - I still want to
> return the record.
>
> It would be good if it simply returns null ... but it throws and
> exception that it cannot find the object.
>
> Is there another way to do this or should I just wrap some exception
> code around it and deal with it.
>
> Thanks,
>
> Lindsay
This archive was generated by hypermail 2.0.0 : Thu Sep 02 2004 - 04:10:35 EDT