openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Heiko Kopp <it-media.k...@daimler.com>
Subject Re: OpenJPA 1.2.2 - setFirstResult/setMaxResults not working for ORACLE 11g
Date Wed, 29 Jun 2011 05:32:01 GMT
Hello,

thank you for your reply. I figured out what the problem was. Apparently
Oracle is trying to optimize this query. In my query, the 'ORDER BY' class
used a non-unique column. However, Oracle seems to optimize a query like
this in a way that modifies row ordering between the subselect and the
outerselect leading to the same entries on different rows.

A trick from a website helped me out. I modified the query


SELECT t FROM Task t ORDER BY t.insertDate DESC;


to


SELECT t FROM Task t ORDER BY t.insertDATE DESC, t.id ASC;


with t.id being the primary key of the table, this builds a correct query
where a single row only appears on a single row number.

So the clue to all this is to in case you order your rows by a non-unique
column, additionally apply a sub-ordering to a unique column.

Nevertheless, thank you very much for your link.

Best regards,

Heiko

--
View this message in context: http://openjpa.208410.n2.nabble.com/OpenJPA-1-2-2-setFirstResult-setMaxResults-not-working-for-ORACLE-11g-tp6500387p6527776.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message