Thanks  a lot for your response!
I am trying to do a java-xml mapping - so no RDBMS involved here.
I have a  schema, and I generated classes using the SourceGenerator. Incidentally, the 
schema has a xd:date type.
 
Then, I tried to generate the mapping file automatically using the MappingTool and the 
generated classes. The tool generated the mapping as previously posted.  
<class cst:name="com.ccmc.cure.xml.procClaims.Claim">

<field cst:name="loss_date" cst:type="org.exolab.castor.types.Date" 
cst:required="true">

<bind-xml name="loss_date" node="element"/>

</field>

</class>

<class cst:name="org.exolab.castor.types.Date">

<description>Default mapping for class org.exolab.castor.types.Date</description>

<map-to cst:xml="date"/>

<field cst:name="content" cst:type="java.lang.String">

<bind-xml name="content" node="text"/>

</field>

</class>

The problem is that there is no getContent() method on org.exolab.castor.types.Date. 

Plus, I wanted to be able to output the value of a java.util.Date as the loss_date. So 
in the java code I created the loss_date field  using the org.exolab.castor.types.Date 
 constructor that accepts a java.util.Date.
 
So the question now is, since there is no getContent method on 
org.exolab.castor.types.Date, do I have to modify the mapping file to use a different 
method instead? If so, is it the toString method?
 
 
Thanks
Nischala

 

 

 

 

 

 
 
 
-----Original Message----- 
From: Werner Guttmann [mailto:[EMAIL PROTECTED] 
Sent: Sat 6/5/2004 4:01 AM 
To: [EMAIL PROTECTED] 
Cc: 
Subject: Re: [castor-user] RE: how do I use mapping and a java.util.Date?




        Nischala,
        
        if you asking about how to use the type org.exolab.castor.types.Date when 
mapping classes to a RDBMS schema, I am afraid this won't work out of
        the box .. ;-). Let me know what your (real) intention is, and we'll take care 
of your problem. It has just happened that we (the committers) discussed this
        very issue a couple of weeks ago, and the fix should be straightforward.
        
        Regards
        Werner
        
         . On Fri, 4 Jun 2004 16:30:19 -0700, Nischala Kale wrote:
        
        >Looks like the link I posted contained an email address, and so was blocked.
        >Here is the question that was posted on castor-dev mailing list, message 
number msg05772
        >==
        >Hi,
        >
        >I have a schema that defines an xsd:date element.  When I generate my objects 
from my
        >xml file, the representative object for xsd:date is 
org.exolab.castor.types.Date.
        >
        >Next, I using the MappingTool utility to generate a mapping.xml file, as I 
eventually
        >want to map these objects to an RDBMS.  A snippet of the nicely formatted 
mapping.xml
        >file follows:
        >
        ><?xml version="1.0"?>
        ><mapping xmlns="http://castor.exolab.org/";;>
        >    <description>Castor generated mapping file</description>
        >
        >    <class name="org.exolab.castor.types.Date" identity="" access="shared">
        >        <description>Default mapping for class 
org.exolab.castor.types.Date</des
        >cription>
        >        <map-to xml="date"/>
        >        <field name="content" type="java.lang.String">
        >            <bind-xml name="content" node="text"/>
        >        </field>
        >    </class>
        >
        >This looks ok to me.  Anyhow, I then run my program and it fails on the 
setMapping()
        >method as follows:
        >
        >
        >org.exolab.castor.mapping.MappingException: The method getContent in class 
org.e
        >xolab.castor.types.Date accepting/returning object of type class 
java.lang.Strin
        >g was not found
        >        at 
org.exolab.castor.mapping.loader.MappingLoader.createFieldDesc(Mappin
        >gLoader.java:719)
        >        at 
org.exolab.castor.xml.XMLMappingLoader.createFieldDesc(XMLMappingLoad
        >er.java:260)
        >        at 
org.exolab.castor.mapping.loader.MappingLoader.createFieldDescs(Mappi
        >ngLoader.java:519)
        >        at 
org.exolab.castor.mapping.loader.MappingLoader.createDescriptor(Mappi
        >ngLoader.java:343)
        >        at 
org.exolab.castor.xml.XMLMappingLoader.createDescriptor(XMLMappingLoa
        >der.java:157)
        >        at 
org.exolab.castor.mapping.loader.MappingLoader.loadMapping(MappingLoa
        >der.java:212)
        >        at org.exolab.castor.mapping.Mapping.getResolver(Mapping.java:278)
        >        at org.exolab.castor.mapping.Mapping.getResolver(Mapping.java:234)
        >        at 
org.exolab.castor.xml.Unmarshaller.setMapping(Unmarshaller.java:224)
        >        at Test.<init>(Test.java:53)
        >        at Test.main(Test.java:34)
        >
        >The basic question is, how does one supply the appropriate mapping for an 
xsd:date? 
        >I'm lost here.  Thank you for your help.
        >
        >
        >-Doug
        >=======
        >
        >
        >       -----Original Message-----
        >       From: Nischala Kale
        >       Sent: Fri 6/4/2004 4:17 PM
        >       To: [EMAIL PROTECTED]
        >       Cc:
        >       Subject: how do I use mapping and a java.util.Date?
        >      
        >      
        >
        >       Hi,
        >
        >          I came across the same problem as the person in this Thread. As I 
did not see any replies about the solution, I'm posting it again. Here is the
        link to the original question -
        >
        >       http://www.mail-archive.com/[EMAIL PROTECTED]/msg05772.html
        >
        >       Can someone help?
        >
        >       Thanks
        >
        >       
        >
        
        
        
        -----------------------------------------------------------
        If you wish to unsubscribe from this mailing, send mail to
        [EMAIL PROTECTED] with a subject of:
                unsubscribe castor-user
        

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

Reply via email to