Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Simple test case for a supposed Datanucleus issue
Java
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
src
.gitignore
LICENSE
README.md
pom.xml

README.md

datanucleus-null-param-query

Simple test case for a supposed Datanucleus issue. See http://www.datanucleus.org/servlet/forum/viewthread_thread,7579

To showcase the issue, simply run mvn test

The failing test parses this JDOQL query:

SELECT FROM ch.thierry.datanucleus.Person WHERE pName == null || name == pName PARAMETERS java.lang.String pName

and generates the following (formatted) SQL for HSQLDB:

SELECT 
    'ch.thierry.datanucleus.Person' AS NUCLEUS_TYPE,
    A0.ID,
    A0.NAME,
    A0.PERSON_ID
FROM
    PERSON A0
WHERE
    (? = NULL) OR (A0.NAME = ?)

The passing test directly uses JDBC with the following SQL:

SELECT 
    'ch.thierry.datanucleus.Person' AS NUCLEUS_TYPE,
    A0.ID,
    A0.NAME,
    A0.PERSON_ID
FROM
    PERSON A0
WHERE
    (? IS NULL) OR (A0.NAME = ?)

(The difference is (? = NULL) vs (? IS NULL)

Something went wrong with that request. Please try again.