Issue Details (XML | Word | Printable)

Key: NUCRDBMS-669
Type: Bug Bug
Status: Closed Closed
Resolution: Cannot Reproduce
Priority: Major Major
Assignee: Unassigned
Reporter: Azuo Lee
Votes: 0
Watchers: 0
Operations

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 projection-with-order.zip (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 h.id asc

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

Sort Order: Ascending order - Click to sort in descending order
Azuo Lee added a comment - 25/Apr/13 12:33 PM
Test case attached.

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).

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:

select e.name
where name.startsWith('Research')
&& emps.contains((com.xyz.hr.Employee) e)

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

select e.name
where name.startsWith('Research')
&& emps.contains((com.xyz.hr.Employee) e)
order by e.name 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