No DataMap found, can't route query

From: Mary-Anne Wolf (mg..ocasystems.com)
Date: Tue Mar 04 2008 - 16:02:42 EST

  • Next message: Ted Moens: "Re: Queries"

    I am just starting to use Cayenne. After successfully reverse
    engineering a database and generating Java classes, I have written this
    minimal program

        public static void main(String[] args) {
           
            DataContext context = DataContext.createDataContext();
            SelectQuery q = new SelectQuery(Mocauser.class);
            List list = context.performQuery(q);
            System.out.println(list.size());
        }

    When I run this code in Eclipse, I get this Exception stack:
    Exception in thread "main" org.apache.cayenne.CayenneRuntimeException:
    [v.2.0.4 October 8 2007] No DataMap found, can't route query
    org.apache.cayenne.query.SelectQuer..3462851[root=class
    com.mocasystems.apui.db.Mocauser,name=<null>]
        at org.apache.cayenne.query.AbstractQuery.route(AbstractQuery.java:137)
        at org.apache.cayenne.query.SelectQuery.route(SelectQuery.java:171)
        at
    org.apache.cayenne.access.DataDomainQueryAction.runQuery(DataDomainQueryAction.java:292)
        at
    org.apache.cayenne.access.DataDomainQueryAction.access$000(DataDomainQueryAction.java:60)
        at
    org.apache.cayenne.access.DataDomainQueryAction$1.transform(DataDomainQueryAction.java:273)
        at
    org.apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:836)
        at
    org.apache.cayenne.access.DataDomainQueryAction.runQueryInTransaction(DataDomainQueryAction.java:270)
        at
    org.apache.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:110)
        at org.apache.cayenne.access.DataDomain.onQuery(DataDomain.java:746)
        at
    org.apache.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:217)
        at
    org.apache.cayenne.access.DataContextQueryAction.execute(DataContextQueryAction.java:54)
        at org.apache.cayenne.access.DataContext.onQuery(DataContext.java:1395)
        at
    org.apache.cayenne.access.DataContext.performQuery(DataContext.java:1384)
        at com.mocasystems.apui.Main.main(Main.java:19)

    My two XML files, currently named cayenne.xml and UntitledMap.map.xml
    are in a config directory which I have listed in Eclipse as a source
    directory. This means that the cayenne.xml file, at least, can be
    found, because it is on the classpath.

    I have verified that the name of the map file is accurately listed in
    cayenne.xml.
    <domains project-version="2.0">
      <domain name="UntitledDomain">
        <map name="UntitledMap" location="UntitledMap.map.xml"/>
      </domain>
    </domains>

    Can anyone give me some help about how the map file is supposed to be
    found, and what might cause my problem in finding the map file?

    Thanks,

    Mary-Anne



    This archive was generated by hypermail 2.0.0 : Tue Mar 04 2008 - 16:03:17 EST