You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by ra...@wipro.com on 2006/07/26 16:16:36 UTC

Error while inserting Null value into MsSQL db


Hi,

   I am using Ibatis as the data mapper between my java classes and
MsSql database. When I am trying to insert null value using java object
  i am getting the null pointer exception.

   but if i directly insert null it works fine.

  For example:


<insert id="insertStaticProperties" parameterClass="user">

insert into USR_BASIC_INFO values (#userid#, #password#, #username#,
#role#, #code#, #email#, #phonenumber#, #description#)

</insert>

The above query throws NULL pointer exception when any of the field
value is null. say #password is NULL.



<insert id="insertStaticProperties" parameterClass="user">

insert into USR_BASIC_INFO values (#userid#, null, #username#, #role#,
#code#, #email#, #phonenumber#, #description#)

</insert>

this works fine. can you please throw some light on this.

Thanks n Regards,
==============

Rambabu



The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

www.wipro.com

Re: Error while inserting Null value into MsSQL db

Posted by Larry Meadors <lm...@apache.org>.
Try:

insert into USR_BASIC_INFO values (#userid#, #password:VARCHAR#, #username#,
#role#, #code#, #email#, #phonenumber#, #description#)

Larry


On 7/26/06, rambabu.piridi@wipro.com <ra...@wipro.com> wrote:
>
>
> Hi,
>
>    I am using Ibatis as the data mapper between my java classes and MsSql
> database. When I am trying to insert null value using java object
>   i am getting the null pointer exception.
>
>    but if i directly insert null it works fine.
>
>   For example:
>
>
> <
> insert id="insertStaticProperties" parameterClass="user">
>
> insert into USR_BASIC_INFO values (#userid#, #password#, #username#,
> #role#, #code#, #email#, #phonenumber#, #description#)
>
> </insert>
> The above query throws NULL pointer exception when any of the field value
> is null. say #password is NULL.
>
>
>
> <
> insert id="insertStaticProperties" parameterClass="user">
>
> insert into USR_BASIC_INFO values (#userid#, null, #username#, #role#,
> #code#, #email#, #phonenumber#, #description#)
>
> </insert>
>
> this works fine. can you please throw some light on this.
> Thanks n Regards,
> ==============
>
> Rambabu
>
> The information contained in this electronic message and any attachments
> to this message are intended for the exclusive use of the addressee(s) and
> may contain proprietary, confidential or privileged information. If you are
> not the intended recipient, you should not disseminate, distribute or copy
> this e-mail. Please notify the sender immediately and destroy all copies of
> this message and any attachments.
>
> WARNING: Computer viruses can be transmitted via email. The recipient
> should check this email and any attachments for the presence of viruses. The
> company accepts no liability for any damage caused by any virus transmitted
> by this email.
>
> www.wipro.com
>