cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mary-Anne Wolf <>
Subject Re: No DataMap found, can't route query
Date Wed, 05 Mar 2008 00:19:15 GMT
Thanks, Michael, but something else appears to be the problem.
The XML files are at the top of the same "bin" directory
where the *.class files are placed.
When I run code in the debugger,
I can detect that the db-entity parts of my map.xml file
are getting loaded, so the problem is not trouble finding the file
The problem appears to be with the obj-entity parts of the XML.

In org.apache.cayenne.util.Util, where it says
*return Class.forName(className, true, classLoader);*
the first class it tries to find in my code is "Account". 
The full name of the class should be "com.mocasystems.apui.db.Account",
so if there is only "Account", forName cannot find it.  Oops!
I am not sure how this happened.
Maybe I assumed Eclipse would do the right thing
when I moved stuff,
but this XML is in the *.map.xml file
<obj-entity name="Account"

So I think I need to modify the *.map.xml file.
Does anyone know if I should add the package information
anywhere besides in the classname of the obj-entity?
Should I change the name as well?  If I do,
I may also need to tweak obj-relationship,
but if I don't, there is more risk of collisions.


Michael Gentry wrote:
> Look at where Eclipse built your .class files/etc and make sure that
> it did indeed put your cayenne.xml file in there when it built the
> project.  It needs to be at the top-level of that classpath.
> /dev/mrg
> On Tue, Mar 4, 2008 at 4:02 PM, Mary-Anne Wolf <> wrote:
>> 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.SelectQuery@43462851[root=class
>>  com.mocasystems.apui.db.Mocauser,name=<null>]
>>     at org.apache.cayenne.query.AbstractQuery.route(
>>     at org.apache.cayenne.query.SelectQuery.route(
>>     at
>>  org.apache.cayenne.access.DataDomainQueryAction.runQuery(
>>     at
>>  org.apache.cayenne.access.DataDomainQueryAction.access$000(
>>     at
>>  org.apache.cayenne.access.DataDomainQueryAction$1.transform(
>>     at
>>  org.apache.cayenne.access.DataDomain.runInTransaction(
>>     at
>>  org.apache.cayenne.access.DataDomainQueryAction.runQueryInTransaction(
>>     at
>>  org.apache.cayenne.access.DataDomainQueryAction.execute(
>>     at org.apache.cayenne.access.DataDomain.onQuery(
>>     at
>>  org.apache.cayenne.util.ObjectContextQueryAction.runQuery(
>>     at
>>  org.apache.cayenne.access.DataContextQueryAction.execute(
>>     at org.apache.cayenne.access.DataContext.onQuery(
>>     at
>>  org.apache.cayenne.access.DataContext.performQuery(
>>     at com.mocasystems.apui.Main.main(
>>  My two XML files, currently named cayenne.xml and
>>  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=""/>
>>   </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

View raw message