db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert S. Sfeir" <rob...@codepuccino.com>
Subject Re: PlatformDefaultImpl in RC5 throwing ClassCastException
Date Sat, 31 Jan 2004 01:53:45 GMT
OOPS

Robert S. Sfeir wrote:

> Ok, for now (I don't know if this is the right fix, but I'm using it 
> for now for myself)
>
> I changed the method to look like this:
> PlatformDefaultImpl line 255
>
> public void setObjectForStatement(PreparedStatement ps, int index, 
> Object value, int sqlType)
>            throws SQLException
>    {
>        if ((value instanceof String) && (sqlType == Types.LONGVARCHAR))
>        {
>            String s = (String) value;
>            ps.setCharacterStream(index, new StringReader(s), s.length());
>        }

this should be:
        else if ((value instanceof String)) // Why are we setting Object 
if value is a String?
       {
           ps.setString( index, value.toString());
       }

>
>        if ((value instanceof String)) // Why are we setting Object if 
> value is a String?
>        {
>            ps.setString( index, value.toString());
>        }
>        else
>        {
>            ps.setObject(index, value, sqlType);
>        }
>    }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message