ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler" <jeffgbut...@gmail.com>
Subject Re: Update Statement Error ?
Date Wed, 26 Apr 2006 16:22:11 GMT
There is no iBATIS issue with NULL.  But in general with nulls, you need to
change your mapping to let iBATIS know about the dataype.  For example:

first_name = #firstName:VARCHAR#,
        last_name = #lastName:VARCHAR#,
        phone = #phone:VARCHAR#,
        fax = #fax:VARCHAR#,
        e_mail = #email:VARCHAR#,
        location = #location:VARCHAR#,
        address1 = #address1:VARCHAR#,
        address2 = #address2:VARCHAR#,
        city = #city:VARCHAR#,
        state = #state:VARCHAR#,
        zip = #zip:VARCHAR#,
        password = #password:VARCHAR#,
                password_last_updated = #password_last_updated:VARCHAR#
        WHERE user_id = #userId:INTEGER#

(Note: use your actual datatypes, I'm just guessing)

Jeff Butler


On 4/26/06, Ali, Mohammed (Liquidity & Risk Technology) <Mohammed_Ali@ml.com>
wrote:
>
>  Hi All,
> I ran the update sql outside with the same values and no issues.
>
> I have "null" data values in updates as column allows NULLS for VARCHAR. I
> think it is giving error on "null" data.
>
> Is there an issue in IBATIS with null data updating in Varchar field?
>
> Thanks,
> Ali
> (201) 671-5499
>
>  -----Original Message-----
> From: larry.meadors@gmail.com [*mailto:larry.meadors@gmail.com*<larry.meadors@gmail.com>]
> On Behalf Of Larry Meadors
> Sent: Wednesday, April 26, 2006 11:08 AM
> To: user-java@ibatis.apache.org; Balaji
> Subject: Re: Update Statement Error ?
>
> Another quick-n-dirty way to find these (if you have a unit test) is
> to remove columns from the update until it works. The last one you
> removed is the problem.
>
> Larry
>
> On 4/26/06, Balaji <balaji@objectec.com> wrote:
> >
> > Ali,
> >
> > It could be because of null value(s) in password date etc. Check the
> > datatype & acceptable value for fields in db table vs the dto.  Execute
> the
> > SQL outside ibatis (winsql, plsql etc) with the values you are passing
> when
> > this error is occuring.  That should give you a better error message.
> >
> >
> > Balaji
> >
> >
> >
> > ----- Original Message -----
> > From: Ali, Mohammed (Liquidity & Risk Technology)
> > To: user-java@ibatis.apache.org
> > Sent: Wednesday, April 26, 2006 9:25 AM
> > Subject: Update Statement Error ?
> >
> >
> >
> >
> > Hi All,
> > I am getting the following error when calling an Update. I can see
> UserDTO
> > is passes properly with data. May be declaration is not right ?
> >
> > Error
> > com.ibatis.common.jdbc.exception.NestedSQLException:
> > --- The error occurred in
> > com/ml/camsweb/resources/User.xml.
> > --- The error occurred while applying a parameter map.
> > --- Check the update-InlineParameterMap.
> > --- Check the statement (update failed).
> > --- Cause: java.sql.SQLException: JZ006: Caught IOException:
> > java.io.IOException: JZ0SL: Unsupported SQL type 0.
> > Caused by: java.sql.SQLException: JZ006: Caught IOException:
> > java.io.IOException: JZ0SL: Unsupported SQL type 0.
> >
> > Update
> > public void update(UserDTO userDTO) throws SQLException {
> >                         try {
> >                                 sqlMapCams.startTransaction();
> >                                 sqlMapCams.update("update",userDTO);
> >                                 sqlMapCams.commitTransaction();
> >                         } finally{
> >                                 sqlMapCams.endTransaction();
> >                         }
> >                 }
> >
> > User.XML
> > <typeAlias alias="UserObject" type="com.ml.camsweb.dto.UserDTO"/>
> >
> > <update id="update" parameterClass="UserObject">
> >         UPDATE users
> >         SET
> >         first_name = #firstName#,
> >         last_name = #lastName#,
> >         phone = #phone#,
> >         fax = #fax#,
> >         e_mail = #email#,
> >         location = #location#,
> >         address1 = #address1#,
> >         address2 = #address2#,
> >         city = #city#,
> >         state = #state#,
> >         zip = #zip#,
> >         password = #password#,
> >                 password_last_updated = #password_last_updated#
> >         WHERE user_id = #userId#
> >     </update>
> >
> >
> > Thanks,
> > Ali
> > (201) 671-5499
> >  ________________________________
> >
> > If you are not an intended recipient of this e-mail, please notify the
> > sender, delete it and do not read, act upon, print, disclose, copy,
> retain
> > or redistribute it. Click here for important additional terms relating
> to
> > this e-mail.     *http://www.ml.com/email_terms/*<http://www.ml.com/email_terms/>
> >  ________________________________
> >
>   ------------------------------
>  If you are not an intended recipient of this e-mail, please notify the
> sender, delete it and do not read, act upon, print, disclose, copy, retain
> or redistribute it. Click here <http://www.ml.com/email_terms/>for
> important additional terms relating to this e-mail.
> http://www.ml.com/email_terms/
>  ------------------------------
>

Mime
View raw message