RE: Trying to set qualifier on a saved query?

From: Gentry, Michael \(Contractor\) ("Gentry,)
Date: Wed Aug 31 2005 - 17:03:53 EDT

  • Next message: Jeff de Vries: "Re: Trying to set qualifier on a saved query?"

    I don't have any other thoughts at the moment. My line numbers differ
    from yours on the stacktrace, so I'll have to update my code baseline
    tonight and then I can augment one of my test apps to try to duplicate
    the problem. If anyone else has ideas, feel free to hop in. :-)
     
    Thanks,
     
    /dev/mrg

            -----Original Message-----
            From: Jeff de Vries [mailto:jdevrie..frog.com]
            Sent: Wednesday, August 31, 2005 4:39 PM
            To: cayenne-use..bjectstyle.org
            Subject: Re: Trying to set qualifier on a saved query?
            
            
            I'm positive the name is getting set properly because as I go
    back and forth changing the "shared cache" value in Modeler, it works
    when it isn't shared cache and doesn't work when it is shared cache.
            
            This works:
                    <query name="NewMakes"
    factory="org.objectstyle.cayenne.map.SelectQueryBuilder"
    root="obj-entity" root-name="Make">
                            <qualifier><![CDATA[availNew = 1]]></qualifier>
                            <ordering
    ignore-case="true"><![CDATA[name]]></ordering>
                    </query>
            
            This doesn't work:
                    <query name="NewMakes"
    factory="org.objectstyle.cayenne.map.SelectQueryBuilder"
    root="obj-entity" root-name="Make">
                            <property
    name="cayenne.GenericSelectQuery.refreshingObjects" value="false"/>
                            <property
    name="cayenne.GenericSelectQuery.cachePolicy" value="sharedcache"/>
                            <qualifier><![CDATA[availNew = 1]]></qualifier>
                            <ordering
    ignore-case="true"><![CDATA[name]]></ordering>
                    </query>
            
            
            Gentry, Michael (Contractor) wrote:

                    According to my 1.2 code tree (which isn't up to 1.2M5
    yet), I see:
                    
                    if (useCache && name == null)
                      throw ... ; // the exception you are seeing
                    
                    The "name" variable is being set by query.getName().
    Are you sure your
                    query name is being saved/set? Double-check the saved
    XML file to
                    ensure the name is saved correctly. Make sure you don't
    have a typo in
                    the name, too.
                    
                    /dev/mrg
                    
                    
                    -----Original Message-----
                    From: Jeff de Vries [mailto:jdevrie..frog.com]
                    Sent: Wednesday, August 31, 2005 3:19 PM
                    To: cayenne-use..bjectstyle.org
                    Subject: Re: Trying to set qualifier on a saved query?
                    
                    
                    I made that change, but it didn't make any difference.
    Here's more
                    detail on the actual error I'm getting:
                    
                    Exception in thread "main"
                    org.objectstyle.cayenne.CayenneRuntimeException:
    [v.1.2M5 July 22 2005]
                    Caching of unnamed queries is not supported.
                        at
            
    org.objectstyle.cayenne.access.DataContextSelectAction.performQuery(Data
                    ContextSelectAction.java:104)
                        at
            
    org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java
                    :1258)
                        at
            
    org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java
                    :1203)
                    
                    Just for grins, I turned "Shared Cache" off, and turned
    "Refresh
                    Results" back on, and that *does* work.
                    
                    
                    Gentry, Michael (Contractor) wrote:
                      

                            I haven't done this, but in the modeler, make
    your qualifier "availNew
                                

                    =
                      

                            1" ...
                            
                            -----Original Message-----
                            From: Jeff de Vries [mailto:jdevrie..frog.com]
                            Sent: Wednesday, August 31, 2005 2:09 PM
                            To: cayenne-use..bjectstyle.org
                            Subject: Trying to set qualifier on a saved
    query?
                            
                            
                            I'm trying to create a saved "object select
    query" using Modeler. My
                            object has a boolean field named "availNew". In
    the "SelectQuery
                            Settings" I'm entering "availNew" into the
    "Qualifier" text box. (I'm
                            also setting "Shared Cache" and unchecking
    "Refresh Results" as this is
                                

                    
                      

                            a small, read-only table).
                            
                            In my code I'm doing:
                              List result =
    dc.performQuery("MyQuery",false);
                            
                            What happens is I get an exception about
    "unnamed queries".
                            
                            I have other saved queries that are not using
    the Qualifier field that
                            are all working fine, so it is something about
    the qualifier.
                            
                            Thanks,
                            Jeff de Vries
                            
                             
                                



    This archive was generated by hypermail 2.0.0 : Wed Aug 31 2005 - 17:03:57 EDT