Hi Tim,
Castor doesn't support switching the date class out-of-the-box, but here
is a workaround:
Grab a copy of the Castor Source Code, there is a file called
XSDate.java:
/castor/src/main/org/exolab/castor/builder/types/XSDate.java
You can modify this file so that it uses java.sql.Date instead of
Castor's built in date.
Then simply compile the class and place it somewhere on your classpath
so that it's found before the castor.jar. (You could also rebuild all of
Castor or stuff the class into the Castor jar, but just dropping it into
your classpath is easiest I think if you are not already building the
Castor sources)
Then anytime you invoke the SourceGenerator, your version of XSDate will
be used and you'll get the java.sql.Date in your generated sources.
--Keith
"Leeuw van der, Tim" wrote:
>
> Hi,
>
> When I specify a type of 'xsd:date' in my xml schema, the generated classes have a
> Castor specific date type. All my code uses java.sql.Date. This gives a lot of
> ugly-looking code. Is it possible to coerce the SourceGenerator to generate
> java.sql.Date instead? And if so, how?
>
> I currently solved the ugliness of code by specifying the schema type
> 'xsd:dateTime', for which java.util.Date is used. This gives reasonably clean code;
> I do however get a problem when converting between ju.Date and js.Date back and
> forth; the timezone indicator is increasing! If Castor can give me java.sql.Dates,
> it might solve me some of my problems.
>
> regards,
>
> --Tim
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL
> and is thus for use only by the intended recipient. If you received this in error,
> please contact the sender and delete the e-mail and its attachments from all
> computers.
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev