Issue Details (XML | Word | Printable)

Type: Bug Bug
Status: Closed Closed
Resolution: Cannot Reproduce
Priority: Major Major
Assignee: Unassigned
Reporter: Azuo Lee
Votes: 0
Watchers: 0

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

Projection of variables throws NullPointerException if a ordering clause is specified

Created: 25/Apr/13 12:32 PM   Updated: 27/Jun/13 04:39 PM   Resolved: 25/Jun/13 07:30 PM
Component/s: None
Affects Version/s: 3.2.1
Fix Version/s: None

File Attachments: 1. Zip Archive (3 kB)

Datastore: MySQL

 Description  « Hide
following JDOQL,

select h.owner, h.address
from org.datanucleus.test.Person
where this.houses.contains(h)
order by asc

can not be executed (NullPointerException thrown), unless the ordering clause is not specified.

Azuo Lee added a comment - 25/Apr/13 12:33 PM
Test case attached.

Azuo Lee made changes - 25/Apr/13 12:33 PM
Field Original Value New Value
Attachment [ 11945 ]
Andy Jefferson added a comment - 25/Apr/13 02:11 PM - edited
An ordering clause has to be comparable to a candidate (i.e what you're selecting, a row), and in this case "h" could have multiple values for any candidate (row). Consequently it has problems evaluating. Put another way, what SQL are you expecting out of that?

If wanting components of the House then doing
SELECT owner, address FROM House WHERE owner != null ORDER BY id ASC
would make more sense (to me).

Andy Jefferson made changes - 25/Apr/13 07:27 PM
Project DataNucleus Core [ 10143 ] DataNucleus Store RDBMS [ 10144 ]
Affects Version/s 3.2.1 [ 11918 ]
Affects Version/s 3.2.1 [ 11914 ]
Azuo Lee added a comment - 26/Apr/13 08:40 AM
In fact, this is just an extended version of the example mentioned by JDO spec 14.10.17:

where name.startsWith('Research')
&& emps.contains(( e)

I just want to order the results returned by that query:

where name.startsWith('Research')
&& emps.contains(( e)
order by asc

This makes sense if Department and Employee has 1-n "unidirectional" association, and I want to query the names of all Employees of all "Research" Departments.

Andy Jefferson added a comment - 25/Jun/13 07:30 PM
I ran your test and don't have any problem

Andy Jefferson made changes - 25/Jun/13 07:30 PM
Status Open [ 1 ] Resolved [ 5 ]
Resolution Cannot Reproduce [ 5 ]
Andy Jefferson made changes - 27/Jun/13 04:39 PM
Status Resolved [ 5 ] Closed [ 6 ]