You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Joachim Björklund <jo...@bizlink.se> on 2002/09/26 08:03:08 UTC

BeanDeser... and java.sql.Date

Hi, when having fields of java.sql.Date in your bean, and when deserializing
from "xsd:dateTime" (internally interpeted as java.util.Calendar) by the
default BeanDeserializer. It will not work.

When Axis tries to set the value in the bean it will fail as the field is
not of type Calendar. Well, Axis then tries to convert the Calendar-value
using the org.apache.axis.utils.JavaUtils class, but the class only handles
java.util.Date's and not java.sql.Date's.

I would suggest to add this functionallity to JavaUtils (if there's not a
good reason to why it's not there in the first place):


org/apache/axis/utils/JavaUtils.java line 246-254

        // Convert between Calendar and java.util.Date
        if (arg instanceof Calendar && destClass == java.util.Date.class) {
            return ((Calendar) arg).getTime();
        }

        // Convert between Calendar and java.sql.Date
        if (arg instanceof Calendar && destClass == java.sql.Date.class) {
            return new java.sql.Date(((Calendar) arg).getTimeInMillis());
        }

regards
Joachim