Re: EOSQLExpression for Query across optional relationships?
Re: EOSQLExpression for Query across optional relationships?
- Subject: Re: EOSQLExpression for Query across optional relationships?
- From: Chuck Hill <email@hidden>
- Date: Fri, 15 Oct 2010 09:36:24 -0700
On Oct 15, 2010, at 9:14 AM, Kieran Kelleher wrote:
> An old issue, but just wanted to throw this out there for discussion.
>
> If I do a query (against MySQL db) where some of the keypaths cross optional relationships, then the results will exclude master entity instances where the optional detail does not exist. This is because of the SQL generated (for the default MySQL plugin anyway) does its table joins using WHERE t0.id = t1.idForeignKey style expressions.
>
>
> So, how do others deal with this?
Set the relationship to Left Outer Join in the EOModel. I don't know how to do this on a query by query basis, if that is what you are after.
> Is this an EOF problem or a MySQL plugin problem? Do other databases/plugins exhibit this same problem? .... or do they automatically generate LEFT JOIN between the master entity table and the related tables as derived from the keyPaths?
>
> Is it straightforward to implement, or a huge task? ..... is a case of just adding this functionality to the MySQLExpression (extends JDBCExpression) class, and overriding assembleJoinClause? Does EOF actually send the appropriate left-outer or right-outer join semantic to that method when appropriate anyway? Must I configure left outer join semantics in the EOModel in advance for my optional detail relationships for this to work?
>
> Pointers, advice, experiences would be much appreciated :-)
Not sure about MySQL. EOF handles this from EOModel settings. Maybe the MySQL plugin is not implementing it?
Chuck
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden