Hi,

After some investigations, it seems to be a bug : the type
is handled by a CollectionFieldHandler in SqlDescriptor =>
the "char[yyyy-MM-dd hh:mm:ss]" value is split into
"char[yyyy-MM-dd" and "hh:mm:ss]" => crash in
org.exolab.castor.jdo.engine.SQLTypes.typeFromName...

I can see two solutions :
- if a type can really have multiple values, the CollectionFieldHandler
should support this particular case (i.e. the [] delimiters)
- if not, than the handler can be a simple XMLFieldHandler

I attached a patch for the second case.

Bruce, should I submit this in Bugzilla ?


> "Armstrong, James (James) ** CTR **" a �crit :
> 
> Hi,
> I am getting the error below when attempting to put a "date" type in
> the database of the format: yyyy-MM-dd hh:mm:ss. The error says that
> this type is not supported. How do I enter date time stamp into the
> database. Is this truly not supported?
> 
> Thanks,
> James
> 
> Here is the mapping file:
> <?xml version="1.0"?>
> <!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Object Mapping DTD Version
> 1.0//EN" "http://castor.exolab.org/mapping.dtd";>
> <mapping>
>   <class name="com.avaya.srd.et2.cre1.cas.MultiCaseJobBean"
> identity="jobId">
>     <description>Job Bean</description>
>     <map-to table="mult_case_jobs"/>
> ...
>       <field name="end" type="date">
>         <sql name="end" type="char[yyyy-MM-dd hh:mm:ss]"/>
>       </field>
>       <field name="begin" type="date">
>         <sql name="begin" type="char[yyyy-MM-dd hh:mm:ss]"/>
> ...
>      </class>
> </mapping>
> 
> org.exolab.castor.mapping.MappingException: The SQL type hh:mm:ss.SSS]
> is not supported in this release
>         at org.exolab.castor.jdo.engine.SQLTypes.typeFromName(Unknown
> Source)
>         at
> org.exolab.castor.jdo.engine.JDOMappingLoader.createFieldDesc(Unknown
> Source)
>         at
> org.exolab.castor.mapping.loader.MappingLoader.createFieldDescs(Unknown
> Source)
>         at
> org.exolab.castor.mapping.loader.MappingLoader.createDescriptor(Unknown
> Source)
>         at
> org.exolab.castor.jdo.engine.JDOMappingLoader.createDescriptor(Unknown
> Source)
>         at
> org.exolab.castor.mapping.loader.MappingLoader.loadMapping(Unknown
> Source)
>         at
> org.exolab.castor.jdo.engine.JDOMappingLoader.loadMapping(Unknown
> Source)
>         at org.exolab.castor.mapping.Mapping.getResolver(Unknown
> Source)
>         at
> org.exolab.castor.jdo.engine.DatabaseRegistry.loadDatabase(Unknown
> Source)
>         at org.exolab.castor.jdo.JDO.getDatabase(Unknown Source)
>         ...

-- 
Mickael Guessant
Index: SqlDescriptor.java
===================================================================
RCS file: 
/cvs/castor/castor/src/main/org/exolab/castor/mapping/xml/SqlDescriptor.java,v
retrieving revision 1.13
diff -r1.13 SqlDescriptor.java
119c119
<         desc.setHandler( new CollectionFieldHandler(handler));
---
>         desc.setHandler( handler );

Reply via email to