Hi Peter,

There is at least one problem with your mapping, but to solve the
problem we need to see the class JdoTest.

The first problem is that you have specified an id field in this line of
the mapping

<class name="JdoTest" identity="id" access="shared">

but you do not include id as a field. To clarify, I would expect to see
something like:

<field name="id" type="integer" >
<sql name="ID" type="integer"/> <-- this should be the primary key field in your 
database table a>
<xml node="attribute"/>
</field>

Naturally, you also need a corresponding id field in the class JdoTest.
Have a look at the JDO Examples, these should make the basic JDO
concepts very clear.

Hope this helps,

Patrick



sagacious wrote:

> here is my code snippet:
> jdo = new JDO("mydb");
> jdo.setConfiguration("database.xml" );
> db = jdo.getDatabase();//get error when execute here
> db.begin();
> oql = db.getOQLQuery( "select c from JdoTest c ");//where id=$1 " );
> ...
> here is my database.xml:
> !DOCTYPE databases PUBLIC "-//EXOLAB/Castor JDO Configuration DTD
> Version 1.0//EN"
> "http://castor.exolab.org/jdo-conf.dtd";>
>
> <database name="mydb" engine="oracle">
> <driver class-name="oracle.jdbc.driver.OracleDriver"
> url="jdbc:oracle:thin:@127.0.0.1:1521:dba">
> <param name="user" value="system" />
> <param name="password" value="manager" />
> </driver>
> <mapping href="./mapping.xml" />
> </database>
> and the mapping.xml:
> <!DOCTYPE databases PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN"
> "http://castor.exolab.org/mapping.dtd";>
> <mapping>
> <!-- Mapping for ProductGroup -->
> <class name="JdoTest" identity="id" access="shared">
> <description>my jdo test</description>
> <map-to table="a" xml="group" />
> <field name="A" type="integer" >
> <sql name="A" type="number"/>
> <xml node="attribute"/>
> </field>
>
> </class>
> </mapping>
> when i compile and run it,the screen display these message:
> org.exolab.castor.mapping.MappingException: The method getA in class
> JdoTest acc
> epting/returning object of type int was not found
> at org.exolab.castor.mapping.loader.MappingLoader.createFieldDesc(Unknow
> n Source)
> at org.exolab.castor.jdo.engine.JDOMappingLoader.createFieldDesc(Unknown
> Source)
> at org.exolab.castor.mapping.loader.MappingLoader.createFieldDescs(Unkno
> wn Source)
> at org.exolab.castor.mapping.loader.MappingLoader.createDescriptor(Unkno
> wn Source)
> at org.exolab.castor.jdo.engine.JDOMappingLoader.createDescriptor(Unknow
> n Source)
> at org.exolab.castor.mapping.loader.MappingLoader.loadMapping(Unknown So
> urce)
> at org.exolab.castor.jdo.engine.JDOMappingLoader.loadMapping(Unknown Sou
> rce)
> at org.exolab.castor.mapping.Mapping.getResolver(Unknown Source)
> at org.exolab.castor.jdo.engine.DatabaseRegistry.loadDatabase(Unknown So
> urce)
> at org.exolab.castor.jdo.JDO.getDatabase(Unknown Source)
> at JdoTest.test(JdoTest.java:47)
> at JdoTest.main(JdoTest.java:79)
> i don't know where the error lie in,who can give me advice?
> i am really know little about CASTORJDO:(
> thank a lot
> Best Regards,
>
> peter collias

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to