I have a class with a field of type java.sql.date.

This is what the mapping file is like:

-------------snip-----------------

 <field name="ErstellungsDatum" type="java.sql.Date">
          <bind-xml name="Erstellungsdatum" node="element"/>

</field>

-------------snap-----------------

Marshalling is ok, and the xml-value of the field is for example: 2002-04-10T09:16:25.344

But when I try to unmarshal the xml-file I get the following error:

unable to add 'Erstellungsdatum' to <Dauerauftrag> due to the following exception:
>>>--- Begin Exception ---<<<
java.lang.IllegalArgumentException: Type conversion error: could not set value of ErstellungsDatum(java.sql.Date) with value of type java.util.Date
at org.exolab.castor.mapping.loader.FieldHandlerImpl.setValue(FieldHandlerImpl.java:460)
at org.exolab.castor.xml.handlers.DateFieldHandler.setValue(DateFieldHandler.java:172)
at org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:526)
at org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1387)
at org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1019)
at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1200)
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:380)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:908)
at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:338)
at at.co.arz.bsserver.util.CastorHelper.unmarshal(CastorHelper.java:74)
at at.co.arz.bsserver.function.dauerauftrag.DauerauftragDemoDataLoader.loadData(DauerauftragDemoDataLoader.java:42)
at at.co.arz.bsserver.function.dauerauftrag.DauerauftragDemoDataLoader.main(DauerauftragDemoDataLoader.java:21)
>>>---- End Exception ----<<<

I have searched and tried a lot but I don't get rid of this problem. I also watched for the so called DateFieldHandler, but I don't know how to use it.

Has anybody an example where my problem is solved? Maybe also that I can write the format yyyy-MM-dd in the xml-File.

Thank you for your help.

Bachlechner Alexander

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

Reply via email to