For DB2, the castor doclet will generate the following mapping and
DDL for a float attribute :

     <field name="floatValue" type="float">
       <sql name="FLOATVALUE" />
       <bind-xml name="floatValue" />
     </field>

FLOATVALUE DECIMAL(16,8) ,

Note that the field type float is specified, but no sql type. The
default is just OK.

You are trying to use type="numeric", which maps to
java.math.BigDecimal, see :
http://castor.exolab.org/types.html


Thomas Olausson wrote:
> when running the .examples jdo
> 
> everything goes well until
> [test] Castor: Loading myapp.Product (4)
> 
> then I get these errors:
> 
> [test] java.lang.IllegalStateException: Field access error: price(java.lang.Float) 
>access resulted in exception: java.lang.reflect.InvocationTargetException
> [test] java.lang.IllegalStateException: Field access error: price(java.lang.Float) 
>access resulted in exception: java.lang.reflect.InvocationTargetException
> [test]        at 
>org.exolab.castor.mapping.loader.FieldHandlerImpl.getValue(FieldHandlerImpl.java:381)
> [test]        at 
>org.exolab.castor.xml.handlers.EnumFieldHandler.getValue(EnumFieldHandler.java:137)
> [test]        at 
>org.exolab.castor.xml.FieldValidator.validate(FieldValidator.java:191)
> [test]        at 
>org.exolab.castor.xml.util.XMLClassDescriptorImpl.validate(XMLClassDescriptorImpl.java:844)
> 
> ... many more similar lines. 
> 
> Inspecting the create.sql, it shows
> price     numeric(18,2) not null,
> 
> It seems like the float->numeric conversion doesn't work with db2
> 
> <field name="price" type="float">
>       <sql name="price" type="numeric" />
>       <xml name="price" node="element" />
>     </field>
> 
> 
> On linux I get Segmentation fault at the same line.
> 
> Is my bug the same one as this link?
> I've seen a simliar post at 
>http://www.mail-archive.com/[email protected]/msg08757.html.
> 
> My setup is
> castor 0.9.3.21
> db2 v7.1
> 
> /Thomas
> 
> ----------------------------------------------------------- 
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>       unsubscribe castor-dev
> 


-- 
Mickael Guessant

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

Reply via email to