Thank you very much Christian!

On Mon, Jul 28, 2008 at 3:39 PM, Poitras Christian <
[EMAIL PROTECTED]> wrote:

>  On MySQL, you can use <=> instead of = for null safe comparison.
>
> <select id="getSomeRecords"  parameterClass="RecordItem"
> resultClass="long">
> SELECT ColumnUID
> WHERE
>     Column1 &lt;=&gt; #property1#
>     AND Column2 = #property2#
> </select>
> You can also test null values with <isNull> tag.
> <select id="getSomeRecords"  parameterClass="RecordItem"
> resultClass="long">
> SELECT ColumnUID
> WHERE
>     <isNull property="property1">
>     Column1 IS NULL
>     </isNull>
>     <isNotNull property="property1">
>     Column1 = #property1#
>      </isNotNull>
>     AND Column2 = #property2#
> </select>
>
>
> Christian
>
>  ------------------------------
> *From:* nullptr rejected [mailto:[EMAIL PROTECTED]
> *Sent:* Monday, July 28, 2008 2:44 PM
> *To:* [email protected]
> *Subject:* SELECT containing NULL
>
>  I am not getting the expected results when executing a select statement
> containing null values.
>
> I have the following example:
>
> <select id="getSomeRecords"  parameterClass="RecordItem"
> resultClass="long">
> SELECT ColumnUID
> WHERE
>     Column1 = #property1#
>     AND Column2 = #property2#
> </select>
>
> In java:
>
> class RecordItem {
>   private String property1;
>   private String property2;
>  ...
> }
>
>
> If I have a RecordItem that has a property1 that has a null value (as read
> from a previous SELECT from that table), then when selecting that record
> from the table, I would expect it to return the record. Is there something
> specific I have to do to get iBATIS to execute a modified SQL that would use
> something like:
>
> SELECT ColumnUID
> WHERE
>   Column1 IS NULL
>   AND Column2 = 'property2Value'
>
> Thank you for any hints or direction you may be able to provide.
>
> -- CD
>

Reply via email to