Re: Fetch Spec bindings with raw SQL hints
Re: Fetch Spec bindings with raw SQL hints
- Subject: Re: Fetch Spec bindings with raw SQL hints
- From: Art Isbell <email@hidden>
- Date: Tue, 12 Aug 2003 10:00:49 -1000
On Tuesday, August 12, 2003, at 05:00 AM, John Boynton wrote:
I am trying to construct a fetch specificiation in EOModeler that
involves paths to to-many relationships. Apple Radar #2841084
("Fetch Specs which reference other entities generate incorrect SQL")
instructs us to use a raw SQL expression to work around the problem.
This bug seems to be specific for fetch specs defined in EOModeler.
Therefore, another workaround might be to define the fetch spec
programmatically. That might be better than including
database-specific SQL in a fetch spec hint.
However, I am at a loss as to how to include the bindings in the raw
SQL that are required by this particular Fetch Specification. How can
I do this?
You will use the bindings to compose an SQL string to set as a fetch
specification hint. A hint is a key-value pair in an NSDictionary.
The key in this case is "CustomQueryExpressionHintKey" with the value
being the SQL string. EOFetchSpecification's setHints() method takes
this hints dictionary as an argument.
The bindings will be set by the time your action method is invoked.
This action method will perform the fetch. So the method will need to
check the values of each binding and add each value to the "where"
clause of the SQL string. You need to determine whether a null binding
value will result in the generation of a "where" clause for that column
or not.
Aloha,
Art
_______________________________________________
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.