Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 506203 - Use Oracle 12c new paging features
Summary: Use Oracle 12c new paging features
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal with 3 votes (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-19 08:09 EDT by Ralf Hockner CLA
Modified: 2022-06-09 10:24 EDT (History)
2 users (show)

See Also:


Attachments
JUnit test class with dynamic entity (6.20 KB, text/plain)
2016-10-19 08:09 EDT, Ralf Hockner CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Hockner CLA 2016-10-19 08:09:26 EDT
Created attachment 264937 [details]
JUnit test class with dynamic entity

With Oracle 12c there comes a new feature for paging of results using "OFFSET m ROWS FETCH NEXT n ROWS ONLY". We would like to have EclipseLink using this feature.
Currently a JPQL query of

SELECT e.lastName FROM Employees e ORDER BY e.lastName

with setFirstResult(100) and setMaxResults(100) results in an inefficient SQL of

SELECT * FROM (SELECT /*+ FIRST_ROWS */ a.*, ROWNUM rnum  FROM (SELECT LAST_NAME AS a1 FROM HR.EMPLOYEES ORDER BY LAST_NAME) a WHERE ROWNUM <= ?) WHERE rnum > ?

but a better SQL for 12c would be

SELECT LAST_NAME FROM HR.EMPLOYEES ORDER BY LAST_NAME OFFSET 100 ROWS FETCH NEXT 100 ROWS ONLY
Comment 1 Eclipse Webmaster CLA 2022-06-09 10:24:54 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink