Issue Details (XML | Word | Printable)

Key: NUCRDBMS-507
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Unassigned
Reporter: renfeng
Votes: 0
Watchers: 0
Operations

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

Parameters in ORDER BY clause won't get populated

Created: 03/Mar/11 03:57 PM   Updated: 01/Apr/11 03:26 PM   Resolved: 08/Mar/11 11:54 AM
Component/s: None
Affects Version/s: 2.2.1, 2.2.2, 2.2.3, 3.0.0.m1, 3.0.0.m2
Fix Version/s: 3.0.0.m3

File Attachments: 1. Zip Archive NUCCORE-670-dist.zip (2 kB)

Environment:
windows 7

java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)

Datastore: MySQL


 Description  « Hide
It'll throw exception by creating a named query as the following.

SELECT FROM XXX
PARAMETERS long t
import XXX;
ORDER BY (t - this.x) * this.y DESCENDING

The exception complains the parameter value is not set.

Sort Order: Ascending order - Click to sort in descending order
Andy Jefferson added a comment - 03/Mar/11 05:02 PM
Project NUCJDOQUERY is for JDO Typesafe queries as the JIRA Project says very clearly.

Testcase to demonstrate this ?
Part of the JDO spec that says it ought to be allowed ?

renfeng added a comment - 03/Mar/11 06:48 PM
Deducing my code to a test case...

Thanks for your quick response, Andy!

renfeng added a comment - 03/Mar/11 07:16 PM
Hi, Andy

Here is the test case.

You might need to modify lines in the file, datanucleus.properties, to suit your own environment:

javax.jdo.option.ConnectionURL=jdbc:mysql://127.0.0.1:3306/test?characterEncoding=utf-8&connectionCollation=utf8_bin
javax.jdo.option.ConnectionUserName=test
javax.jdo.option.ConnectionPassword=test

renfeng added a comment - 03/Mar/11 07:21 PM
To see the exception, run

mvn test

Andy Jefferson added a comment - 04/Mar/11 12:42 PM
Suggest that you read the docs for what type of testcase is accepted
http://www.datanucleus.org/project/problem_jdo_testcase.html

renfeng added a comment - 05/Mar/11 02:04 PM
Ok. Allow me sometime to re-phrase.

renfeng added a comment - 05/Mar/11 02:52 PM
Done.

Andy Jefferson added a comment - 08/Mar/11 10:37 AM
Because most JDBC drivers don't allow "?" in the order by clause, so just use a literal in the query, since there is nothing (to do with performance) to be gained by parameterising it.

Andy Jefferson added a comment - 08/Mar/11 11:54 AM
SVN trunk simply does what the user should do : convert the parameter into a literal. Means that the datastore-specific compilation can't be precompiled but then that's how JDBC drivers are