Re: NSDictionary and FetchSpecificationNamed usage
Re: NSDictionary and FetchSpecificationNamed usage
- Subject: Re: NSDictionary and FetchSpecificationNamed usage
- From: Dev WO <email@hidden>
- Date: Wed, 19 Oct 2005 19:51:24 +0200
Hi Arturo,
thanks, at least it compiles.
But I get a null pointer exception...
I though comparing the primary key would be "faster" or more
efficient as it doesn't have to compare the entire object and just
request for the PK.
I should send the entire object as a qualifier for the fetch?
that would be:
((quantityAvailable <> quantity) and (product = $product))
in the eomodel and
NSDictionary theProduct = new NSDictionary("product", product);
in the code?
Maybe I'm viewing it in the wrong way.
Here's what I'd like to do in fact:
-I've got a table "order" with the order references (date, person
name, etc)
-I've got another table "item" with the items and it is joined to
"order".
What I need to do is when I add more quantity to a product, I'd like
to check all the "items" that belongs to this product (I've got a
relationship between "the product" and "item"),
and for each item, I'd like to check a couple parameter inside
themselves and in their related "order" before doing anything with my
provisioning product.
I though I could get directly the array of "item", but maybe I should
do it in several steps.
What's your opinion?
thanks Arturo
Xavier
Dev WO wrote:
-----
public void provisioningOrder(Product product,
ProductProvisioning provisioning) {
CustomerOrderItem aCustomerOrderItem;
NSMutableDictionary theProduct = new NSMutableDictionary();
theProduct = ((NSArray)product.valueForKey("productPK"));
EOFetchSpecification fetchSpec =
EOFetchSpecification.fetchSpecificationNamed
("FetchSpecItemSortedByOrderDateForAProductAndRefresh",
"CustomerOrderItem");
EOFetchSpecification boundFs =
fetchSpec.fetchSpecificationWithQualifierBindings(theProduct);
-----
I just need to fetch the CustomerOrderItem for the specific
object product!
My namedFetchSpecification is handling the sorting and some extra
qualifier.
Could someone explain me in a human readable language;) what I'm
doing wrong? obviously I'm doing something wrong:)
Thanks
Xavier
Well, you shouldn't be using the primary key as one thing.
Another thing is that you're not putting anything into the array.
Try this
NSDictionary theProduct = new NSDictionary("productPK",
product);
Or even
NSMutableDictionary theProduct = new NSMutableDictionary();
theProduct.setObjectForKey(product, "paramName");
But really, get rid of the primary key from the object so that you
can pass the EO without extracting its primary key first.
_______________________________________________
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