Re: [OS-JIRA] Created: (CAY-441) unnamed query error on named query

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Mon Feb 06 2006 - 19:20:20 EST

  • Next message: Cris Daniluk: "Re: [OS-JIRA] Created: (CAY-441) unnamed query error on named query"

    NamedQuery is also used as a client proxy for server-side query, and
    queryName vs. name property was introduced to avoid an infinite loop
    during NamedQuery resolution that occurred some time ago. Of course
    the solution broke other things (CAY-441). Now that the underlying
    stack has evolved, we may no longer need that. I am looking at
    removing 'queryName'. Let me do a quick test and see if it works
    without it.

    Andrus

    On Feb 6, 2006, at 7:08 PM, Cris Daniluk wrote:

    > This is because NamedQuery introduces a queryName field which seems to
    > be redundant to IndirectQuery.name.
    >
    > Is there a reason why they're both? I made a simple patch that takes
    > out queryName, and instead uses IndirectQuery.name, but I didn't know
    > if queryName was what we were moving to. In that case, it would
    > probably be better to just dual-set queryName to name in the
    > constructor.
    >
    > On 2/6/06, jira-norepl..bjectstyle.org <jira-
    > norepl..bjectstyle.org> wrote:
    >> Message:
    >>
    >> A new issue has been created in JIRA.
    >>
    >> ---------------------------------------------------------------------
    >> View the issue:
    >>
    >> http://objectstyle.org/jira/secure/ViewIssue.jspa?key=CAY-441
    >>
    >>
    >> Here is an overview of the issue:
    >> ---------------------------------------------------------------------
    >> Key: CAY-441
    >> Summary: unnamed query error on named query
    >> Type: Bug
    >>
    >> Status: Assigned
    >> Priority: Minor
    >>
    >> Project: Cayenne
    >> Components:
    >> Cayenne Core Library
    >> Versions:
    >> 1.2 [DEV]
    >>
    >> Assignee: Andrus Adamchik
    >> Reporter: Cris Daniluk
    >>
    >> Created: Mon, 6 Feb 2006 6:51 PM
    >> Updated: Mon, 6 Feb 2006 6:51 PM
    >>
    >> Description:
    >> After updating CVS, I'm receiving an exception while executing a
    >> named query, retrieved as such:
    >>
    >> DataContext context = DataContext.createDataContext();
    >> DataMap map = ((DataMap) context.getEntityResolver
    >> ().getDataMaps().iterator().next());
    >>
    >> Iterator queryIter = map.getQueries().iterator();
    >>
    >> while (queryIter.hasNext()) {
    >> Query query = (Query) queryIter.next();
    >>
    >> if (query.getName().startsWith("Cache")) {
    >> context.performQuery(query.getName(), true);
    >> }
    >>
    >> }
    >>
    >> Basically, I'm trying to avoid lazy loading on certain named
    >> cached queries. However, I'm getting an error about it being an
    >> unnamed query:
    >>
    >> org.objectstyle.cayenne.CayenneRuntimeException: [v.1.2-dev
    >> February 6 2006] Caching of unnamed queries is not supported.
    >> Query: NamedQuery:null
    >> at
    >> org.objectstyle.cayenne.access.DataDomainQueryAction.interceptSharedC
    >> ache(DataDomainQueryAction.java:238)
    >> at
    >> org.objectstyle.cayenne.access.DataDomainQueryAction.execute
    >> (DataDomainQueryAction.java:137)
    >> at org.objectstyle.cayenne.access.DataDomain.onQuery
    >> (DataDomain.java:724)
    >> at org.objectstyle.cayenne.access.Transaction.onQuery
    >> (Transaction.java:206)
    >> at org.objectstyle.cayenne.access.DataDomain.onQuery
    >> (DataDomain.java:721)
    >> at
    >> org.objectstyle.cayenne.util.ObjectContextQueryAction.runQuery
    >> (ObjectContextQueryAction.java:244)
    >> at
    >> org.objectstyle.cayenne.access.DataContextQueryAction.execute
    >> (DataContextQueryAction.java:89)
    >> at org.objectstyle.cayenne.access.DataContext.onQuery
    >> (DataContext.java:1261)
    >> at org.objectstyle.cayenne.access.DataContext.performQuery
    >> (DataContext.java:1250)
    >> at org.objectstyle.cayenne.access.DataContext.performQuery
    >> (DataContext.java:1444)
    >> at org.objectstyle.cayenne.access.DataContext.performQuery
    >> (DataContext.java:1425)
    >> at
    >> ...
    >>
    >>
    >> ---------------------------------------------------------------------
    >> JIRA INFORMATION:
    >> This message is automatically generated by JIRA.
    >>
    >> If you think it was sent incorrectly contact one of the
    >> administrators:
    >> http://objectstyle.org/jira/secure/Administrators.jspa
    >>
    >> If you want more information on JIRA, or have a bug to report see:
    >> http://www.atlassian.com/software/jira
    >>
    >>
    >



    This archive was generated by hypermail 2.0.0 : Mon Feb 06 2006 - 19:20:23 EST