• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Outer joins in EOFetchSpecification?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Outer joins in EOFetchSpecification?


  • Subject: Re: Outer joins in EOFetchSpecification?
  • From: Jonathan Rochkind <email@hidden>
  • Date: Wed, 10 Sep 2003 13:45:31 -0500

I don't think there's any way to do this by modifying the fetch spec or qualifier. However, you can _define_ the relationship as an outer join in the model. See EOModeler, inspect the relationship, look around for the panel that lets you define this.

Of course, you probably don't _want_ the relationship in general to be an outer join (that wouldn't make much sense anyway), you just want it to be treated as one for this particular fetch. Well, you could leave the original relationship alone, but define a duplicate of it, which is NOT marked as a class property, as an outer join (left or right). Since it's not marked as a class property, it wont' generaly be used for anything. But since it's there, even not marked as a class property, you can still use it in a qualifier.

I've never done this, but it should work I'm pretty sure. Of course, you do this enough, and you've really cluttered up your model with all these 'extra' relationships.

Other possibilities would be coming up with an SQL query that includes a sub-query, that does the same thing as your outer join. I think that theoretically any outer join can be re-constructed with a subquery instead. Of course, then you just have a different problem, which is, how do you create a qualifier for a sub-query? There's no built in way to do it, but I think there's some stuff in project wonder that might help. Or you could try building your own using EOSQLQualifier. But, while I've gotten subquerries to work on several occasions, it's generally a pain, admittedly.

That's all the ideas I have; hope they help,
--Jonathan

At 12:16 PM 9/10/2003 -0600, John Boynton wrote:
Hi all,

Is there a way to get an EOFetchSpecification to use an outer join for a relationship key instead of a simple join? I have a ChargeItem entity which can have an optional relationship "job" to a Job entity. I'd like to qualify on a user-entered date such that if the job is null, use the chargeDate; otherwise use the job's completion date. The qualifier string for this would be:

"(job = nil and chargeDate >= %@) or (job <> nil and job.completionDate >= %@)"

But this will generates a simple join clause like:

  FROM CHARGE_ITEM t0, JOB T1 WHERE t0.JOB_FK = T1.PRIMARY_KEY AND ...

instead of what I really want (using Oracle 9i syntax):

FROM CHARGE_ITEM t0 LEFT OUTER JOIN JOB T1 ON t0.JOB_FK = T1.PRIMARY_KEY WHERE ...

Is there a (simple) way to make the fetch spec. use the outer join instead?

Thanks,
John
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Outer joins in EOFetchSpecification? (From: John Boynton <email@hidden>)

  • Prev by Date: Outer joins in EOFetchSpecification?
  • Next by Date: RE: Outer joins in EOFetchSpecification?
  • Previous by thread: Outer joins in EOFetchSpecification?
  • Next by thread: RE: Outer joins in EOFetchSpecification?
  • Index(es):
    • Date
    • Thread