Charles,
there's one more alternative that just crossed my mind. Let's assume you have a
property x of type String in a class named X, along the lines of
class X {
private String x;
public void setX (String x) { ...}
public String getX() { .. }
}
You could add two more methods
public Date getXasDate () { .. }
public void setX (Date x) { ... }
and make Castor use the newly defined getter/setter by declaring get-method and
set-method attributes on the >field> element.
Werner
On Fri, 5 Nov 2004 09:18:18 GMT, Charles Abell wrote:
>Thanks Werner,
>I had read it, but assumed it referred to a date stored as characters in a database,
>to be converted to date in the object.
>
>Anyway the example gives me :
>org.exolab.castor.mapping.MappingException: The SQL type d, is not supported in this
>release
>
>Maybe it's easier to change the format using xsl.
>
>Charles
>
>>
>> Charles,
>>
>> have you ever read about parameterized type conversion at
>>
>> http://castor.exolab.org/types.html#Parameterized-Type-Convertors
>>
>> This might be a possible solution for your case.
>>
>> Werner
>>
>> On Thu, 4 Nov 2004 12:49:17 GMT, Charles Abell wrote:
>>
>>> Martin,
>>>
>>> Many thanks for the example, but regretfully not. I suspect the
>>> difference is my mapping has the extra line :
>>> <sql name="QU_DATE" type="date" dirty="ignore" />
>>>
>>> Stack trace is below.
>>>
>>> Best regards
>>>
>>> Charles
>>>
>>> org.exolab.castor.mapping.MappingException: No convertor exists
>>> for converting type java.lang.String to type java.sql.Date
>>>
>>> at
>>> org.exolab.castor.jdo.engine.SQLTypes.getConvertor(SQLTypes.java:475)
>>>
>>> at
>>> org.exolab.castor.jdo.engine.JDOMappingLoader.getTypeInfo(JDOMappingLo
>>> ader.java:223)
>>>
>>> at
>>> org.exolab.castor.mapping.loader.MappingLoader.createFieldDesc(Mapping
>>> Loader.java:632)
>>>
>>> at
>>> org.exolab.castor.jdo.engine.JDOMappingLoader.createFieldDesc(JDOMappi
>>> ngLoader.java:246)
>>>
>>> at
>>> org.exolab.castor.mapping.loader.MappingLoader.createFieldDescs(Mappin
>>> gLoader.java:519)
>>>
>>> at
>>> org.exolab.castor.mapping.loader.MappingLoader.createDescriptor(Mappin
>>> gLoader.java:343)
>>>
>>> at
>>> org.exolab.castor.jdo.engine.JDOMappingLoader.createDescriptor(JDOMapp
>>> ingLoader.java:147)
>>>
>>> at
>>> org.exolab.castor.mapping.loader.MappingLoader.loadMapping(MappingLoad
>>> er.java:212)
>>>
>>> at
>>> org.exolab.castor.jdo.engine.JDOMappingLoader.loadMapping(JDOMappingLo
>>> ader.java:295)
>>>
>>> at org.exolab.castor.mapping.Mapping.getResolver(Mapping.java:278)
>>>
>>> at
>>> org.exolab.castor.jdo.engine.DatabaseRegistry.loadDatabase(DatabaseReg
>>> istry.java:289)
>>>
>>> at org.exolab.castor.jdo.JDO.getDatabase(JDO.java:559)
>>
>>
>> ----------------------------------------------------------- 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