ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From friendVU admin <maill...@friendvu.com>
Subject Re: Better Solution for null properties
Date Fri, 11 Feb 2005 23:20:56 GMT
Why.. yes there is!
    insert into A (
                     name, ... )
    values (  
                #name:VARCHAR:NO_ENTRY#, ...
     )

Works same on updates. Some notes in docs.

.V


Nathan Maves wrote:

> Is there a better way for dealing with null attributes?
>
> Currently I have to do something like..
>
> <insert id="insertA">
>     insert into A (
>         id
>         <isNotNull prepend="," property="name">
>         name
>         </isNotNull>
>     ) values (
>         #id#
>         <isNotNull prepend="," property="name">
>         #name#
>         </isNotNull>
>     )
> </insert>
>
> or
>
> <insert id="insertA">
>     insert into A (
>         id,
>         name
>     ) values (
>         #id#
>         <isNotNull prepend="," property="name">
>         #name#
>         </isNotNull>
>         <isNull prepend="," property="name">
>         null
>         </isNotNull>
>     )
> </insert>
>
> This become very tedious when you have 10+ columns that might be 
> null.  Why does this happen with Oracle?  Is there anyway that iBatis 
> could check if the property was null and if so call the setNull() of a 
> prepared statement?  I am sure that I am over simplifying the process 
> but just thought I would throw it out there.
>
> Nathan
>
>
>


Mime
View raw message