RE: Trying to set qualifier on a saved query?

From: Gentry, Michael \(Contractor\) ("Gentry,)
Date: Wed Aug 31 2005 - 21:13:52 EDT


Hi Jeff,
 
I updated my 1.2 code base and created a named/cached query and got the
same exception as you at the same location. After a little debugging I
discovered there is a bug/omission in the 1.1 and 1.2 baselines that
you've stumbled upon. I'll open up a ticket for this. For now, please
use your workaround.
 
Thanks!
 
/dev/mrg
 

        -----Original Message-----
        From: Jeff de Vries [mailto:jdevrie..frog.com]
        Sent: Wednesday, August 31, 2005 5:11 PM
        To: cayenne-use..bjectstyle.org
        Subject: Re: Trying to set qualifier on a saved query?
        
        
        Thanks for all the help. For right now I can workaround by just
not using the shared cache ...
        
        Jeff
        
        Gentry, Michael (Contractor) wrote:

                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 - 21:13:56 EDT