You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@metamodel.apache.org by "Kasper Sørensen (JIRA)" <ji...@apache.org> on 2014/11/07 15:13:33 UTC

[jira] [Commented] (METAMODEL-85) isNull() uses = instead of IS NULL in SQL update query

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

Kasper Sørensen commented on METAMODEL-85:
------------------------------------------

There's a missing .execute() at the end of your update statement. It isn't just a case that the statement isn't run at all?

I seem to recall that we've faced this before and fixed it, but I might be dreaming :)

> isNull() uses = instead of IS NULL in SQL update query 
> -------------------------------------------------------
>
>                 Key: METAMODEL-85
>                 URL: https://issues.apache.org/jira/browse/METAMODEL-85
>             Project: Metamodel
>          Issue Type: Bug
>    Affects Versions: 4.2.0-incubating
>         Environment: JDK 8 on Windows 7
>            Reporter: Dennis Du Krøger
>
> An update statement with a isNull() should with a JdbcDataContext translate to WHERE hello IS NULL, but instead translates to "WHERE hello = NULL", which does not work as intended, since NULL in SQL is never equal to anything, even other NULLs.
> {code}
>     private void testCode(){
>         _dataContext.executeUpdate(new UpdateScript() {            
>             @Override
>             public void run(UpdateCallback callback) {
>                 callback.update("foo").value("bar", 1).where("baz").eq(2).where("hello").isNull();
>             }
>         });
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)