Re: FetchSpecs over derived attributes
Re: FetchSpecs over derived attributes
- Subject: Re: FetchSpecs over derived attributes
- From: Chuck Hill <email@hidden>
- Date: Mon, 16 Apr 2007 14:29:12 -0700
On Apr 16, 2007, at 2:25 PM, Robert Walker wrote:
Well, how about that. Learn something new everyday.
:-)
I tried this myself in a quick test. Here's the full SQL from my
test fetch specification:
Fetch Spec:
EOQualifier qual = EOQualifier.qualifierWithQualifierFormat("value3
< 50.0", null);
EOFetchSpecification fs = new EOFetchSpecification("Person", qual,
null);
value3 is the derived attribute...
SQL output:
"SELECT t0.first_name, t0.last_name, t0.id, t0.value_1, t0.value_2,
value_1 + value_2 FROM people t0 WHERE value_1 + value_2 < ?"
withBindings: 1:50.0(value3)>
So in the simple case this appears to work as expected. I would
guess that the derived attribute in question may be too complex for
this to work properly. I've run into similar cases where a fetch
that can be performed in memory cannot be translated to SQL. This
may be what's happening in the case in question.
If we go back to the original question, we see:
java.lang.IllegalStateException: sqlStringForAttribute: attempt to
generate SQL for attribute 'attributeName' on entity 'EntityName'
with undefined column name. You must define a column name for this
attribute before attempting a database operation.
The
attribute 'attributeName' on entity 'EntityName'
part looks suspiciously wrong and the "undefined column name"
certainly is. It looks like the attribute in question is damaged or
incomplete.
Chuck
On Apr 16, 2007, at 4:57 PM, John Huss wrote:
It resolves the attribute names to the columns names as you would
expect, so you get
Select ...
Where (inm_productTax1 + inm_productTax2 + inm_productTax3) > 0
John
On 4/16/07, Robert Walker <email@hidden> wrote:
Fetch spec qualifier = "totalTaxes > 0"
Interesting. What does the generated SQL look like?
On Apr 16, 2007, at 3:45 PM, John Huss wrote:
Here's an example:
Attribute name = "totalTaxes"
Attribute derived definition = "productTax1 + productTax2 +
productTax3"
(productTax* are attribute names in the same entity, not the
column names)
Fetch spec qualifier = "totalTaxes > 0"
This works for any kind of fetch spec.
John
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
--
Robert Walker
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
--
Robert Walker
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net
This email sent to email@hidden
--
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