Client Side Sorting + Hibernate Paging?

I use GWT for UI and Hibernate / Spring for buisness level. The GWT symbol is used to display entries. ( http://collectionofdemos.appspot.com/demo/com.google.gwt.gen2.demo.scrolltable.PagingScrollTableDemo/PagingScrollTableDemo.html ). I assume that sorting is done on the client side.

I do not extract the entire set of results from the moment of its huge amount. I use

principals = getHibernateTemplate().findByCriteria(criteria,
                    fromIndex, numOfRecords);

to retrieve data. There are no criteria for sorting in a sleep mode layer.

This approach does not give the correct behavior, since it only sorts the current data set in the client.

What is the best solution for this problem?

NOTE. I can get the primary sort columns and other sort columns using the user interface structure. Maybe I can sort the result using primary-sort-column in the sleep layer?

+3
source share
3 answers

You need to sort on the server.

Then you can:

  • send a complete set of results to the client and pagination on the client side . The problem is that the result set can be large for retrieving from db and sending it to the client.

  • . db. , , 1, . 2 .. , db . .

  • ( ):

    • , 300
    • db 301
    • ( 301 )
    • 301 , " 300 . ".

1: , . ( ), , , . " 2023 , 300 ".

2: - , db ( , Oracle) . , 1 2, . , , (, ). Db . , (, ORDER BY date, PK), .

3: , .

+4
  • . "" "id"
  • . .
  • / . , .

, .

+3

, .

Since the data set is huge, sending the entire data set to the user, as well as viewing and sorting by page, is unchanged.

This leaves only sorting and swapping on the server. You can use Criteria.addOrder () to sort in sleep mode. See this tutorial .

+1
source

All Articles