Hello Marco,
the format of the database.xml changed from previous versions to 0.9.6. For MySQL it now should look like:
<?xml version="1.0" ?>
<!DOCTYPE jdo-conf PUBLIC "-//EXOLAB/Castor JDO Configuration DTD Version 1.0//EN"
"http://castor.exolab.org/jdo-conf.xsd">
<jdo-conf>
<database name="mysql" engine="mysql" >
<driver url="jdbc:mysql://localhost:3306/test" class-name="com.mysql.jdbc.Driver">
<param name="user" value="test" />
<param name="password" value="test" />
</driver>
<mapping href="jdo/mapping.xml" />
</database>
<transaction-demarcation mode="local" />
</jdo-conf>
Regards Ralf
Marco Mistroni schrieb:
Hello all,, I have just downloaded castor 0.9.5.6, and I am getting problems when instantiating castor JDO due to problems in reading databae.xml file
I can't figure out what should be the proper structure of database.xml file
The one that I have attached resembles the one that I was using with version 0.9.5.2...
The exception that I am getting is as follows
com.myapp.exceptions.PersistenceException: java.lang.Exception: Error in initial izing cpmgr!org.exolab.castor.mapping.MappingException: Nested error: unable to find FieldDescriptor for 'driver' in ClassDescriptor of jdo-conf{file: file:C:/S w/Budget-Project/Backend/target/test-classes/database.xml; line: 3; column: 87} 2004-11-14 11:42:23,328 ERROR com.myapp.castor.CastorPersistenceManagerTest [ma in] - Exception in testQueryExpenseType java.lang.NullPointerException
any help?
Thanks in advance and regards Marco
------------------------------------------------------------------------
<database name="test" engine="mysql" > <driver url="jdbc:mysql://localhost:3306/test" class-name="com.mysql.jdbc.Driver"> <param name="user" value="root" /> <param name="password" value="mypass" /> </driver> <mapping href="mapping.xml" /> </database>
------------------------------------------------------------------------
<?xml version="1.0"?>
<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Mapping DTD Version 1.0//EN" "http://castor.exolab.org/mapping.dtd">
<!-- This mapping file is generated by XDoclet. Please do not edit! -->
<mapping>
<!-- =================================================================== --> <!-- Mapping for class com.myapp.castor.CastorUser --> <!-- =================================================================== -->
<class name="com.myapp.castor.CastorUser" identity="userid" access="shared" auto-complete="false"> <map-to table="user" xml="user" /> <cache-type type="count-limited" />
<field name="password" type="java.lang.String" get-method="getPassword" set-method="setPassword"> <sql name="password" type="char" dirty="check" /> <bind-xml name="password" node="text" /> </field>
<field name="userid" type="integer" get-method="getUserid" set-method="setUserid"> <sql name="userid" type="integer" dirty="check" /> <bind-xml name="userid" node="attribute" /> </field>
<field name="username" type="java.lang.String" get-method="getUsername" set-method="setUsername"> <sql name="username" type="char" dirty="check" /> <bind-xml name="username" node="text" /> </field>
</class>
<!-- =================================================================== --> <!-- Mapping for class com.myapp.castor.CastorExpenseType --> <!-- =================================================================== -->
<class name="com.myapp.castor.CastorExpenseType" identity="id" access="shared" auto-complete="false"> <map-to table="types" xml="expense" /> <cache-type type="count-limited" />
<field name="description" type="java.lang.String" get-method="getDescription" set-method="setDescription"> <sql name="description" type="char" /> <bind-xml name="description" node="attribute" /> </field>
<field name="id" type="integer" get-method="getId" set-method="setId"> <sql name="id" type="integer" /> <bind-xml name="id" node="attribute" /> </field>
</class>
<!-- =================================================================== --> <!-- Mapping for class com.myapp.castor.CastorEntry --> <!-- =================================================================== -->
<class name="com.myapp.castor.CastorEntry" identity="id" access="shared" auto-complete="false"> <map-to table="entries" xml="entry" /> <cache-type type="count-limited" />
<field name="id" type="integer" get-method="getId" set-method="setId"> <sql name="id" /> <bind-xml name="id" node="attribute" /> </field>
<field name="date" type="java.util.Date" get-method="getDate" set-method="setDate"> <sql name="date" type="date" /> <bind-xml name="date" node="text" /> </field>
<field name="description" type="java.lang.String" get-method="getDescription" set-method="setDescription"> <sql name="description" type="char" dirty="check" /> <bind-xml name="description" node="text" /> </field>
<field name="type" type="integer" get-method="getType" set-method="setType"> <sql name="type" type="integer" dirty="check" /> <bind-xml name="type" node="text" /> </field>
<field name="amount" type="double" get-method="getAmount" set-method="setAmount"> <sql name="amount" type="double" dirty="check" /> <bind-xml name="amount" node="text" /> </field>
<field name="user" type="java.lang.String" get-method="getUser" set-method="setUser"> <sql name="user" type="char" dirty="check" /> <bind-xml name="user" node="text" /> </field>
</class>
<!-- Define your key-generator declaration in a file called key-generator.xml and place it in your merge directory. -->
</mapping>
------------------------------------------------------------------------
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
--
Syscon Ingenieurbüro für Meß- und Datentechnik GmbH Ralf Joachim Raiffeisenstraße 11 D-72127 Kusterdingen Germany
Tel. +49 7071 3690 52 Mobil: +49 173 9630135 Fax +49 7071 3690 98
Email: [EMAIL PROTECTED] Web: www.syscon-world.de
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev