nurkiewicz / spring-data-jdbc-repository

Spring Data JDBC generic DAO implementation
275 stars 151 forks source link

Use SQL standard OFFSET .. FETCH instead of ROW_NUMBER() pagination for Derby #19

Closed lukaseder closed 9 years ago

lukaseder commented 9 years ago

I've had a brief review of your solution and found that you're using ROW_NUMBER() OVER() window functions for pagination in Derby: https://github.com/nurkiewicz/spring-data-jdbc-repository/blob/master/src/main/java/com/nurkiewicz/jdbcrepository/sql/DerbySqlGenerator.java#L13

But Derby supports the SQL standard OFFSET .. FETCH clause: http://db.apache.org/derby/docs/10.6/ref/rrefsqljoffsetfetch.html

Why aren't you using that instead?

nurkiewicz commented 9 years ago

Thank you very much, indeed you are right. I guess I was misguided by official FAQ (point 5.2) suggesting OFFSET ... FETCH was introduced in 10.7 - but apprently it's already available in 10.5. Once again thanks for reporting this.

lukaseder commented 9 years ago

Sure, no worries. I just learned that Derby has partial support for window functions :)