Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6861003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:28:48+00:00 2026-05-27T02:28:48+00:00

I want to add sorting to a HTML table populated by Hibernate. The actual

  • 0

I want to add sorting to a HTML table populated by Hibernate. The actual sorting has to be done by a database. To feed “Order by” condition to the database Java has to match passed sort parameters to a column in a query. I’m unsure how to implement this matching.

I could pass something like “Employee.salary” but then this condition need to be checked like all parameters passed from client. This check would require getting column name from Hibernate annotations, and this is not easy I guess. Also, the column can be query-specific and not corresponding to a table field.

Another way is to use hardcoded values in a presentation layer. But this will tie presentation layer with a persistence layer, which is also not good I think.

How do you deal with server-side sorting in web applications?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T02:28:48+00:00Added an answer on May 27, 2026 at 2:28 am

    If I have an Employee entity, then I want an EmployeeRepository that lets me findEmployeesBySalary(SortType sortType, int skip, int limit)

    From the web service side, I want a URI like

    foo.com/employees?by=salary&skip=10&limit=50
    

    which returns something like (as a AJAX XHR call)

    <employees>
        <employee uri="/employee/1" />
        <employee uri="/employee/2" />
        <employee uri="/employee/3" />
    </employees>
    

    or the full-blown HTML page rendered appropriate.

    This conveniently allows caching of employees on the client side (which the cache size being flexible) and at the HTTP level.

    Note that, column names? Irrelevant. You would have a HiberateEmployeeRepository that implements the EmployeeRepository interface as needed. Express this stuff as methods, and use complex parameters if you need to.

    You could even have two separate methods if you want, rather than an enum, findHighestPaidEmployees and findLowestPaidEmployees – foo.com/employees?salary=lowest&skip=10&take=30 mind you, that’s a horribly depressing URI.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want add new Feed item on entity persist and update. I write this
I want an adaptable database scheme. But still use a simple table data gateway
I want to add some Ajax sorting options to a list. Since my site
I am creating table with AjaxFallbackDefaultDataTable. I want to add image to each column
My 'contents' table has about 10,000,000 rows. I used column 'register_date' for sorting in
I want add UIGestureRecognizerDelegate to UIWebView,but failed. if [self.view addsubView:webView]; So UIWebView is ok,but
I want add label to every row in tableview at right side of the
I want add my custom sidebar next right column all page. Please check this
I have a website built with ASP.NET (3.5) and want add some level of
I have a list of string values that I want add to a hashtable

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.