Issue Details (XML | Word | Printable)

Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Unassigned
Reporter: Peter Dettman
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
DataNucleus Store RDBMS

JDOQL2: Passing null parameter value results in incorrect SQL

Created: 14/May/10 05:46 AM   Updated: 24/May/10 03:43 PM   Resolved: 17/May/10 08:59 AM
Component/s: Queries
Affects Version/s: 2.1.0.m2
Fix Version/s: 2.1.0.m3

Datastore: PostgreSQL

 Description  « Hide
Querying a simple class Box, with a nullable recursive field 'parent':

    Query test = pm.newQuery(Box.class);
    test.setFilter("parent == :parent");

JDOQL-Legacy works fine, returning the expected rows. Logs show this was executed:
SELECT FROM box this WHERE this.parent_id IS NULL

JODQL(2) returns no rows (but no error is raised). Logs show this was executed:
SELECT FROM box a0 LEFT OUTER JOIN box b0 ON a0.parent_id = WHERE = <null>

The query works fine when parent is not null.

Using a literal 'null' in the query works too i.e.

    Query test = pm.newQuery(Box.class);
    test.setFilter("parent == null");

although the SQL is a bit weird (JDOQL2):

    SELECT FROM box a0 LEFT OUTER JOIN box b0 ON a0.parent_id = WHERE IS NULL

Andy Jefferson added a comment - 17/May/10 08:59 AM
Works for me with SVN trunk. Add a testcase that demonstrates this if not working with current code

Andy Jefferson made changes - 17/May/10 08:59 AM
Field Original Value New Value
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 2.1.0.m3 [ 10943 ]
Resolution Fixed [ 1 ]
Peter Dettman added a comment - 19/May/10 12:54 PM
Thanks Andy, confirm it's working for me with SVN trunk.

Andy Jefferson made changes - 24/May/10 03:43 PM
Status Resolved [ 5 ] Closed [ 6 ]