Hi, Xavier,

The code should look like this:

================================================
        argsStorage = new NSMutableArray();
        argsStorage.addObject(selectedFormFactor); // this is a toOne
        argsStorage.addObject(selectedFormType); // this is a toOne
argsStorage.addObject(selectedConnector); // this is the toMany that doesn't return any results (NOTE CHANGE HERE) qualStorage = EOQualifier.qualifierWithQualifierFormat ("(productFormFactor = %@) and (productFormType = %@) and (productExternalConnectors = %@)", argsStorage);

// followed by something like:

EOFetchSpecification fetchSpec = new EOFetchSpecification ("MyEntity", qualStorage, null); NSArray results = myEditingContext.objectsWithFetchSpecification (fetchSpec);
================================================

My only point earlier was that the second argument to qualifierWithQualifierFormat must be an NSArray (with a String as the first argument). As an aside, the number of "%@" references in the string must match the number of elements in the NSArray, but you seem to be doing that.

I would suggest modifying your code to the above and adding the runtime parameter:

  -EOAdaptorDebugEnabled Yes

to your application startup. Check the SQL that's generated to confirm that it selects the results you're looking for. If it seems like it should and you're still not getting the results you expect, then I would suspect a problem in the database (e.g. it doesn't have the data or structure that you're expecting).

If the generated SQL does NOT conform to your expectations, then I would suspect a problem with the EOModel.

Regards,
Jerry


On Feb 14, 2006, at 4:41 AM, Dev WO wrote:
Hello Jerry,
Hi, Xavier,

It would help to know how your code is failing, but I don't see why your code wouldn't work so long as "arg" is an NSArray.
The code is not failing in fact, it's just there's no result return.

If arg is an instance of Connector rather than an NSArray, then change your qualifier generating statement to the following:

EOQualifer myQualifier = EOQualifer.qualifierWithQualifierFormat("connectors = %@", new NSArray(arg));
Actually I was trying with an instance of connector, I also tried with an NSArray of connector but no luck.

Here's my code:
        argsStorage = new NSMutableArray();
        argsStorage.addObject(selectedFormFactor); // this is a toOne
        argsStorage.addObject(selectedFormType); // this is a toOne
argsStorage.addObject(new NSArray(selectedConnector)); // this is the toMany that doesn't return any results qualStorage = EOQualifier.qualifierWithQualifierFormat ("(productFormFactor = %@) and (productFormType = %@) and (productExternalConnectors = %@)", argsStorage);

Maybe that's easier to understand than my description;)

On Feb 13, 2006, at 6:15 PM, Dev WO wrote:

Hi,
I don't know if I'm doing it wrong or if I'm just misuse EOQualifier but: I have an entity a with a flattened manyToMany relationship named connectors on a connector entity.

I need to qualify a fetch on entity a based on having connector %@
so basically I was doing
EOQualifer.qualifierWithQualifierFormat("connectors = %@", arg);
arg having a connector entity.

But this doesn't seemed to work...
Am I doing this wrong?

--
__ Jerry W. Walker,
WebObjects Developer/Instructor for High Performance Industrial Strength Internet Enabled Systems

    [EMAIL PROTECTED]
    203 278-4085        office



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to