You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Andrus Adamchik (JIRA)" <ji...@apache.org> on 2014/02/25 19:06:26 UTC

[jira] [Commented] (CAY-1903) In-memory matching using Expressions with nulls

    [ https://issues.apache.org/jira/browse/CAY-1903?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13911807#comment-13911807 ] 

Andrus Adamchik commented on CAY-1903:
--------------------------------------

Thanks for the detailed overview. I am linking it to CAY-1877... I suspected both are the same issue. 

> In-memory matching using Expressions with nulls
> -----------------------------------------------
>
>                 Key: CAY-1903
>                 URL: https://issues.apache.org/jira/browse/CAY-1903
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Core Library
>    Affects Versions: 3.2.M2
>            Reporter: David Feshbach
>
> When a NULL is encountered in a WHERE clause in SQL, it stays NULL (not true or false) unless it is part of an IS NULL, IS NOT NULL, AND (false), or OR (true). If the entire expression is NULL, the row is not matched.
> Cayenne Expressions behave differently in memory. Additionally there is a breaking change in CAY-1860. Expressions that used to work, (and matched database behavior,) now throw an exception. For example:
> Expression expr = Artist.DATE_OF_DEATH.gt(new Date(0));
> This expression used to match all artists that died after 1970 and exclude all living artists. Now it throws an exception if it tries to match a living artist.
> before CAY-1860:
> (null) > 0              -> false
> NOT ((null) > 0)   -> true
> 0 > (null)              -> false
> 0 < (null)              -> false
> after CAY-1860:
> (null) > 0              -> ExpressionException
> NOT ((null) > 0)   -> ExpressionException
> 0 > (null)              -> true
> 0 < (null)              -> false
> In SQL:
> (null) > 0              -> null (no match)
> NOT ((null) > 0)   -> null
> 0 > (null)              -> null
> 0 < (null)              -> null
> NOT (null)            -> null
> (null) AND (true)  -> null
> (null) OR (false)   -> null
> (null) OR (true)    -> true
> (null) AND (false) -> false



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)