As far as I can tell, it looks ok to me. I've never used the XML
encoder, but if it were a SelectQuery qualifier, I'd expect it to
work.
On 3/3/08, Ted Moens <tmoen..elus.net> wrote:
> Hi Mike:
>
> Thanks and I understand the need for details. The relationship is a
> simple one. A "Game" belongs to a "Grouping" and there are many games
> in a grouping. My model is full of similar relationships.
>
> When I use the XML encoder to dump all the games in a grouping to the
> client, there is no problem. Or, when I use the XML encoder to show
> attributes of the grouping associated with a particular game, it also
> works fine.
>
> Here are two expressions I use in the code the first is based on a test
> against a simple attribute:
> expressionList.add(ExpressionFactory.matchExp("gameState", new
> ExpressionParameter("gameState")));
>
> No problem, queries work. Here is the one for comparing to a Game's
> Grouping's name:
>
> expressionList.add(ExpressionFactory.matchExp("toGrouping.groupingName",
> new ExpressionParameter("groupingId")));
>
> This is where I get the runtime error:
>
> Can't resolve path component: [Grouping.groupingName]
>
> Here is the data model for my "Game" class minus a lot of noise
> attributes...
> ---------------- db part ---------------------
> <db-entity name="game" catalog="ultiscore">
> sMandatory="true" length="10"/>
> <db-attribute name="gameState" type="CHAR" isMandatory="true"
> length="11"/>
> <db-attribute name="groupingId" type="INTEGER" isMandatory="true"
> length="10"/>
> </db-entity>
> -------------------- db relationship part ------------------
> <db-relationship name="toGrouping" source="game" target="grouping"
> toMany="false">
> <db-attribute-pair source="groupingId" target="groupingId"/>
> </db-relationship>
> ------------------ object part --------------------
> <obj-entity name="Game" className="org.tsw.ultiserver.Game"
> dbEntityName="game">
> <obj-attribute name="gameState" type="java.lang.String"
> db-attribute-path="gameState"/>
> </obj-entity>
> ------------------ object relationship part --------------------
> <obj-relationship name="toGrouping" source="Game" target="Grouping"
> db-relationship-path="toGrouping"/>
>
>
> And here is the Grouping Class again minus the junk:
> --------------------------------------
> <db-entity name="grouping" catalog="ultiscore">
> <db-attribute name="groupingName" type="VARCHAR" isMandatory="true"
> length="50"/>
> </db-entity>
> --------------------------------------
> <db-relationship name="gameArray" source="grouping" target="game"
> toMany="true">
> <db-attribute-pair source="groupingId" target="groupingId"/>
> </db-relationship>
> --------------------------------------
> <obj-entity name="Grouping" className="org.tsw.ultiserver.Grouping"
> dbEntityName="grouping">
> <obj-attribute name="groupingName" type="java.lang.String"
> db-attribute-path="groupingName"/>
> </obj-entity>
> --------------------------------------
> <obj-relationship name="gameArray" source="Grouping" target="Game"
> db-relationship-path="gameArray"/>
>
> ============================
>
>
> Ted
>
>
>
> Mike Kienenberger wrote:
> > The first thing I would check is to verify that you have an
> > ObjRelationship named "Artist" from your root entity. Note that the
> > name is "toArtist" in the analogous code.
> >
> > It's somewhat difficult to comment on the cause of a concrete error
> > given only theoretical environment information :-)
> >
> > The relevant sections of your DataMap + the actual code would be helpful.
> >
> > On 3/3/08, Ted Moens <tmoen..elus.net> wrote:
> >> Greetings:
> >>
> >> I am trying to do a parameterized select query. My situation is
> >> directly analogous to the example:
> >>
> >> list.add(ExpressionFactory.matchExp("paintingTitle",
> >> new ExpressionParameter("pname")));
> >> list.add(ExpressionFactory.matchExp("toArtist.artistName",
> >> new ExpressionParameter("aname")));
> >>
> >> I follow this pattern but I run into troubles with when the first
> >> argument to the matchExp is an attribute of an object other than the
> >> target class itself. So in the above example, the first expression
> >> works fine but the second would fail with the following:
> >>
> >> Can't resolve path component: [Artist.artistName])
> >>
> >> I've very carefully checked that in other situations the attribute
> >> analogous to Artist.artistName is in fact accessible.
> >>
> >> Is there a common error made in these situations?
> >>
> >> Thanks in advance for any help.
> >>
> >> Ted
> >>
> >> FYI...
> >>
> >>
> >> at org.apache.cayenne.map.Entity$PathIterator.next(Entity.java:375)
> >> at
> >> org.apache.cayenne.access.trans.QueryAssemblerHelper.appendObjPath(QueryAssemblerHelper.java:90)
> >> at
> >> org.apache.cayenne.access.trans.QualifierTranslator.objectNode(QualifierTranslator.java:338)
> >> at org.apache.cayenne.exp.Expression.traverse(Expression.java:455)
> >> at org.apache.cayenne.exp.Expression.traverse(Expression.java:452)
> >> at org.apache.cayenne.exp.Expression.traverse(Expression.java:432)
> >> at
> >> org.apache.cayenne.access.trans.QualifierTranslator.doTranslation(QualifierTranslator.java:74)
> >> at
> >> org.apache.cayenne.access.trans.SelectTranslator.createSqlString(SelectTranslator.java:123)
> >> at
> >> org.apache.cayenne.dba.mysql.MySQLSelectTranslator.createSqlString(MySQLSelectTranslator.java:31)
> >> at
> >> org.apache.cayenne.access.trans.QueryAssembler.createStatement(QueryAssembler.java:95)
> >> at
> >> org.apache.cayenne.access.jdbc.SelectAction.performAction(SelectAction.java:71)
> >> at
> >> org.apache.cayenne.access.DataNodeQueryAction.runQuery(DataNodeQueryAction.java:57)
> >> at org.apache.cayenne.access.DataNode.performQueries(DataNode.java:236)
> >> at
> >> org.apache.cayenne.access.DataDomainQueryAction.runQuery(DataDomainQueryAction.java:446)
> >> at
> >> org.apache.cayenne.access.DataDomainQueryAction.access$000(DataDomainQueryAction.java:67)
> >> at
> >> org.apache.cayenne.access.DataDomainQueryAction$2.transform(DataDomainQueryAction.java:418)
> >> at
> >> org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:853)
> >> at
> >> org.apache.cayenne.access.DataDomainQueryAction.runQueryInTransaction(DataDomainQueryAction.java:415)
> >> at
> >> org.apache.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:119)
> >> at org.apache.cayenne.access.DataDomain.onQuery(DataDomain.java:746)
> >> at
> >> org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:282)
> >> at
> >> org.apache.cayenne.access.DataContextQueryAction.execute(DataContextQueryAction.java:59)
> >> at org.apache.cayenne.access.DataContext.onQuery(DataContext.java:1323)
> >> at
> >> org.apache.cayenne.access.DataContext.performQuery(DataContext.java:1312)
> >> at org.tsw.ultiserver.getXMLData.processRequest(getXMLData.java:138)
> >> at org.tsw.ultiserver.getXMLData.doGet(getXMLData.java:159)
> >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
> >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> >> at
> >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
> >> at
> >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
> >> at
> >> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> >> at
> >> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
> >> at
> >> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
> >> at
> >> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
> >> at
> >> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
> >> at
> >> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
> >> at
> >> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
> >> at
> >> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
> >> at
> >> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
> >> at
> >> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
> >> at
> >> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
> >> at java.lang.Thread.run(Unknown Source)
> >>
> >>
> >
> >
>
>
This archive was generated by hypermail 2.0.0 : Tue Mar 04 2008 - 13:36:57 EST