JDOQL ordering using primary key field


Page bloom
 
Edited

If a class does not have an attribute defined to be the primary key field but, rather, relies on DN creating the primary key column in the RBDMS table implicitly, is there any way to specify the default primary key colunn in the ordering clause:

e.g.

Query q = ....
q.setOrdering(score ascending, PRIMARYKEYCOLUMN ascending)

I know the column exists in the RDBMS table and could write the native SQL to set up ordering that included it but at the Java level there is no Java attribute to refer to it in JDOQL that I am aware of. 

Perhaps DN has some keyword that can be used to represent the underlying, implicitly created primary key field.




 


Andy
 

JDO has

"SELECT FROM mydomain.MyClass ORDER BY JDOHelper.getObjectId(this)"


Page bloom
 
Edited

Thanks Andy, that worked well.

I used it within my setOrdering call:

setOrdering("score ascending, JDOHelper.getObjectId(this) ascending);