15 December 2010

BUG: Toplink doesn't correctly interpret named queries when you use setMaxResults() and setFirstResult()

Hi folks,

I found some bug in toplink that is shipped with Oracle App Server 10.1.3.4.0 (actually among many bugs!!)

According to JPA1.0 specs, Query.setMaxResults() and Query.setFirstResult() methods doesn't work with only queries that contains FETCH JOIN.

But unfortantely, when I tried these two methods with a normal INNER JOIN query, I got the query being changed and returned invalid results!!

So, beware of this!!!

Workaround:
One workaround is to make the join by equity joining columns.
ex:
select s from Suppliers s, Products p where s.productId = p.productId

No comments: