Andrew,
Your mapping an integer for theCusstomerType to a customerType object, and
obviously, Castor is unable to convert from integer to the customer type. I
believe that the mapping for theCustomerType should use a sql-many mapping
(this is the appropriate mechanism for mapping a 1-1 as well as a 1-m)
instead of mapping the integer directly:
<field name="theCustomerType"
type="com.vwfs.CustomerType"
get-method="getCustomerType"
set-method="setCustomerType"
required="true">
<sql many-key="customer_type_id"/>
</field>
Hope this helps -
Margaret
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 23, 2002 4:55 AM
To: [EMAIL PROTECTED]
Subject: [castor-dev] MappingException
> I have a Customer class, that has an attribute of CustomerType. This is a
> one-to-one relationship.
> I'm getting this error, and I can't work out why. I've read through all
> the posts, but haven't been able to find a solution.
> Can someone point me in the right direction?
> Thanks
>
> Nested error: org.exolab.castor.mapping.MappingException: No convertor
> exists for converting type java.math.BigDecimal to type CustomerType
> org.exolab.castor.mapping.MappingException: No convertor exists for
> converting type java.math.BigDecimal to type CustomerType
> at
> org.exolab.castor.jdo.engine.SQLTypes.getConvertor(SQLTypes.java:475)
> at
> org.exolab.castor.jdo.engine.JDOMappingLoader.getTypeInfo(JDOMappingLoader
> .java:222)
> at
> org.exolab.castor.mapping.loader.MappingLoader.createFieldDesc(MappingLoad
> er.java:774)
> at
> org.exolab.castor.jdo.engine.JDOMappingLoader.createFieldDesc(JDOMappingLo
> ader.java:246)
> at
> org.exolab.castor.mapping.loader.MappingLoader.createFieldDescs(MappingLoa
> der.java:519)
> at
> org.exolab.castor.mapping.loader.MappingLoader.createDescriptor(MappingLoa
> der.java:343)
> at
> org.exolab.castor.jdo.engine.JDOMappingLoader.createDescriptor(JDOMappingL
> oader.java:147)
> at
> org.exolab.castor.mapping.loader.MappingLoader.loadMapping(MappingLoader.j
> ava:212)
> at
> org.exolab.castor.jdo.engine.JDOMappingLoader.loadMapping(JDOMappingLoader
> .java:295)
> at org.exolab.castor.mapping.Mapping.getResolver(Mapping.java:278)
> at
> org.exolab.castor.jdo.engine.DatabaseRegistry.loadDatabase(DatabaseRegistr
> y.java:289)
> at org.exolab.castor.jdo.JDO.getDatabase(JDO.java:559)
> at Recording.setupJDO(Recording.java:75)
> at Recording.insert(Recording.java:361)
> at TestCastor.main(TestCastor.java:40)
> java.lang.NullPointerException
> at Recording.insert(Recording.java:364)
> at TestCastor.main(TestCastor.java:40)
> Exception in thread "main"
>
> <mapping>
> <!-- Mapping for com.vwfs.Customer -->
> <class name="Customer" identity="iCustomerTypeID iCustomerID"
> depends="CustomerType" key-generator="MAX">
>
> <description>Customer</description>
> <map-to table="customers" xml="customer" />
>
> <field name="iCustomerID" type="integer" get-method="getCustomerID"
> set-method="setCustomerID">
> <sql name="customer_id" type="integer" />
> <xml name="customer_id" node="element" />
> </field>
>
> <field name="iCustomerTypeID" type="integer"
> get-method="getCustomerTypeID" set-method="setCustomerTypeID">
> <sql name="customer_type_id" type="integer" />
> <xml name="customer_type_id" node="element" />
> </field>
>
> <field name="sNickname" type="string" get-method="getNickname"
> set-method="setNickname">
> <sql name="nickname" type="char" />
> <xml name="nickname" node="element" />
> </field>
>
> <field name="sEmailAddress" type="string"
> get-method="getEmailAddress" set-method="setEmailAddress">
> <sql name="email_address" type="char" />
> <xml name="email_address" node="element" />
> </field>
>
> <field name="theCustomerType"
> type="com.vwfs.CustomerType"
> get-method="getCustomerType"
> set-method="setCustomerType"
> required="true">
> <sql name="customer_type_id" type="integer"/>
> </field>
>
> </class>
> </mapping>
>
>
> <mapping>
> <!-- Mapping for com.vwfs.CustomerType -->
> <class name="CustomerType" identity="iCustomerTypeID"
> key-generator="MAX">
>
> <description>CustomerType</description>
> <map-to table="customer_types" xml="customer_type" />
>
> <field name="iCustomerTypeID" type="integer"
> get-method="getCustomerTypeID" set-method="setCustomerTypeID">
> <sql name="customer_type_id" type="integer" />
> <xml name="customer_type_id" node="element" />
> </field>
>
> <field name="sDescription" type="string" get-method="getDescription"
> set-method="setDescription">
> <sql name="description" type="char" />
> <xml name="description" node="element" />
> </field>
> </class>
> </mapping>
>
****************************************************************************
******
The opinions expressed in this E-mail are those of the individual and
not necessarily the company. This E-mail and any files transmitted
with it are confidential and solely for the use of the intended recipients
****************************************************************************
******
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev