DataNucleus JIRA is now in read-only mode. Raise any new issues in GitHub against the plugin that it applies to. DataNucleus JIRA will remain for the foreseeable future but will eventually be discontinued
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.

Andy Jefferson made changes - 03/Mar/11 05:01 PM
Field Original Value New Value
Project DataNucleus JDO Query [ 10280 ] DataNucleus Core [ 10143 ]
Key NUCJDOQUERY-6 NUCCORE-670
Affects Version/s 3.0.0.m1 [ 11060 ]
Affects Version/s 2.2.1 [ 11091 ]
Affects Version/s 2.2.1 [ 11145 ]
Affects Version/s 3.0.0.m1 [ 11146 ]
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 ?

Andy Jefferson made changes - 03/Mar/11 05:02 PM
Priority Major [ 3 ] Incomplete [ 6 ]
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 made changes - 03/Mar/11 07:16 PM
Attachment NUCCORE-670.zip [ 11366 ]
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 made changes - 05/Mar/11 02:51 PM
Attachment NUCCORE-670-dist.zip [ 11370 ]
renfeng made changes - 05/Mar/11 02:51 PM
Attachment NUCCORE-670.zip [ 11366 ]
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 made changes - 08/Mar/11 10:37 AM
Priority Incomplete [ 6 ] Minor [ 4 ]
Andy Jefferson made changes - 08/Mar/11 11:52 AM
Project DataNucleus Core [ 10143 ] DataNucleus Store RDBMS [ 10144 ]
Key NUCCORE-670 NUCRDBMS-507
Affects Version/s 3.0.0.m2 [ 11151 ]
Affects Version/s 3.0.0.m1 [ 11062 ]
Affects Version/s 2.2.3 [ 11136 ]
Affects Version/s 2.2.2 [ 11127 ]
Affects Version/s 2.2.1 [ 11090 ]
Affects Version/s 3.0.0.m1 [ 11060 ]
Affects Version/s 2.2.1 [ 11091 ]
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

Andy Jefferson made changes - 08/Mar/11 11:54 AM
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 3.0.0.m3 [ 11191 ]
Resolution Fixed [ 1 ]
Andy Jefferson made changes - 01/Apr/11 03:26 PM
Status Resolved [ 5 ] Closed [ 6 ]