Re: Fetch Spec. like Modeler

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Mon Aug 30 2004 - 10:13:14 EDT

  • Next message: Gentry, Michael: "RE: Fetch Spec. like Modeler"

    Sorry, I should've posted this link:

    http://objectstyle.org/cayenne/userguide/datactxt/performquery.html

    Basically all you do is dataContext.performQuery("QName", false). If
    the last argument is "true", result refreshing is forced no matter what
    the mapped query setting is.

    Andrus

    On Aug 30, 2004, at 10:02 AM, Sako! wrote:
    > and how does the java code looks like to read the Query?
    >
    > regards.
    >
    > Sako
    >
    > ----- Original Message -----
    > From: "Andrus Adamchik" <andru..bjectstyle.org>
    > To: <cayenne-use..bjectstyle.org>
    > Sent: Monday, August 30, 2004 3:58 PM
    > Subject: Re: Fetch Spec. like Modeler
    >
    >
    > What you need to here is to create a new query using the right-most
    > button on the toolbar. When the modeler asks for the type of query, use
    > "Object Query". Then for the qualifier use "nr = $nr" - very similar to
    > EOF.
    >
    > Andrus
    >
    >
    > On Aug 30, 2004, at 8:00 AM, Sako! wrote:
    >
    >> Hello,
    >> i would like to know if i can create a Fetch Specification in Cayenne
    >> like in EOModeler.
    >> i mean i want to get the Qualifier in Cayenne like this :
    >>
    >> Ads.fspec file
    >> -------------------------------------------------------------
    >> {
    >> "Fetch Ads" = {
    >> class = EOFetchSpecification;
    >> entityName = Ads;
    >> fetchLimit = 0;
    >> isDeep = YES;
    >> qualifier = {
    >> class = EOKeyValueQualifier;
    >> key = nr;
    >> selectorName = "isEqualTo:";
    >> value = {_key = nr; class = EOQualifierVariable; };
    >> };
    >> refreshesRefetchedObjects = YES;
    >> requiresAllQualifierBindingVariables = YES;
    >> };
    >> }
    >> -------------------------------------------------------------
    >> Qualifier in EOModeler
    >> (nr= $nr)
    >>
    >> Code in java :
    >>
    >> EOFetchSpecification fs =
    >> EOFetchSpecification.fetchSpecificationNamed(fetch, entity);
    >>
    >>
    >>
    >> NSMutableDictionary bindings = new NSMutableDictionary();
    >>
    >> bindings.setObjectForKey(specialistNr, "nr"); // specialistNr Integer
    >>
    >> fs = fs.fetchSpecificationWithQualifierBindings(bindings);
    >>
    >> NSArray objects = ec.objectsWithFetchSpecification(fs); // ec
    >> EdetingContext
    >>
    >> if (objects.count() > 0)
    >>
    >> {
    >>
    >> return (EOGenericRecord) objects.objectAtIndex(0);
    >>
    >> }
    >>
    >> else
    >>
    >> {
    >>
    >> return null;
    >>
    >> }
    >> -------------------------------------------------------------
    >>
    >> if possilbe please give me the url how to use that.
    >>
    >> Regards.
    >>
    >> Sako.
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Mon Aug 30 2004 - 10:13:19 EDT