Re: CustomQueryExpressionHintKey and rawRowKeyPaths?
Re: CustomQueryExpressionHintKey and rawRowKeyPaths?
- Subject: Re: CustomQueryExpressionHintKey and rawRowKeyPaths?
- From: Chuck Hill <email@hidden>
- Date: Tue, 7 Mar 2006 12:34:17 -0800
On Mar 7, 2006, at 12:25 PM, Art Isbell wrote:
On Mar 7, 2006, at 9:02 AM, Marcos Trejo Munguia wrote:
I am trying to make a fetch using custom SQL, I tried with
CustomQueryExpressionHintKey, but I also needed to return raw rows
instead of complete Enterprise Objects, the thing is that it looks
like if I use raw rows my custom SQL is ignored. Here is the code:
EOFetchSpecification fs = new EOFetchSpecification
("Inventory", null, null, false, false, null);
fs.setHints(new NSDictionary("SELECT t0.productid, t0.qty FROM
public.inventory t0 WHERE t0.productid IN(1, 2, 3, 4, 5, 6)",
"CustomQueryExpressionHintKey");
fs.setRawRowKeyPaths(new NSArray(new String[] {"productid",
"qty"}));
fs.setRefreshesRefetchedObjects(true);
NSArray inventory = ec.objectsWithFetchSpecification(fs);
Logged SQL:
SELECT t0.productid, t0.qty FROM public.inventory
as you can see my SQL was ignored.
Am I doing something wrong?, or the CustomQueryExpressionHintKey
is only intended to fetch complete EO's?
I don't know the answer. However, when one sets the SQL string in
setHints() and then specifies the raw row key paths, which takes
precedence since you could list different key paths than are
specified in the SQL string? If you're fetching raw rows, can the
object snapshots be refreshed?
It is possible that they could be, but AFAIK, they are not.
Without all class properties being fetched, I can't see how the
snapshots could be refreshed, so what does
setRefreshesRefetchedObjects() really do in this situation.
Even if you fetch all the properties (class or otherwise) in the raw
row and then convert that into an object using objectFromRawRow, EOF
will still go back to the DB for the snapshot data.
Instead, I'd try EOUtilities.rawRowsForSQL().
Yep.
Chuck
--
Coming in 2006 - an introduction to web applications using WebObjects
and Xcode http://www.global-village.net/wointro
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
_______________________________________________
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