Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HQL paginateing and sorting problem

 
Sharon whipple
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
I have simple html grid (html table) displaying page 5 of 10 pages (each page contain 5 rows)
currently when i sort the grid - the page data is lost (because i am sorting all results not just page 4 results)
I would like to sort just the results of page 5 ,
Is it possible to sort the current page using HQL or I have to sort the result list with comparator?
I got the page rows by running:



Thank you
 
Arun Kumarr
Ranch Hand
Posts: 661
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can implement a ResultTransformer and sort it.
personally, I'd prefer having some sort of UI plug-in which can sort only the page data because the data can be sorted in any order from the UI.
If it is a simple sort and if it is not going to change, you can always add a order by clause at the end of your query.
 
Sharon whipple
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Arun
Client side sorting won’t be easy (since its a web application..)
Thank you for the reference, I will investigate the ResultTransformer class.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic