I'm using postres database and hibernate in my application. Database pagination is working ok untill with this example:
in database table A i have columns id,value1,value2,and others not relevant here...
for example I have:
id value1 value2 other columns... . . rowN: 5 2345 0 some data rowN+1: 6 0 2345 same data as in row1 . . I'm using sort by greatest(value1,value2) function.
The problem is when i use pagination with 5 rows per page (data is displayed in rich datatable with datascroller and 5 rows per page):
when rowN with id 5 is displayed in page1 as the last row (row 5 in datatable with 5 rows per page), then rowN+1 with id 6 should be in page2 as the first row (row 1 in datatable with 5 rows per page) but this is not happening ! Instead, rowN is again displayed as the first row in page2 and rowN+1 is lost ??!! How can that be ? When i check ids that hibernate returns whit this search I clearly see id 5 as last record and then again id 5 as first record (and should be id 6) ! It looks like hibernate evaluating of greatest(value1,value2) is not working well in this example with pagination as it returns twice the same row... Does anyone know what could be the problem ? Thanks in advance.
|