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 8598879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:15:45+00:00 2026-06-12T01:15:45+00:00

We have a Java web app with a hibernate backend that provides REST resources.

  • 0

We have a Java web app with a hibernate backend that provides REST resources. Now we’re facing the task to implement a generic search that is controlled by the query parameters in our get request:

some/rest/resource?name_like=foo&created_on>=2012-09-12&sort_by_asc=something

or similar.

  • We don’t want to predefine all possible parameters(name, created_on,
    something)
  • We don’t want to have to analyze the request String to pick up control characters (like >=)
  • nor do we don’t want to implement our own grammar to reflect things like _eq _like _goe and so on (as an alternative or addition to control characters)

Is there some kind of framework that provides help with this mapping from GET request parameters to database query?

Since we know which REST resource we’re GETing we have the entity / table (select). It probably will also be necessary to predefine the JOINs that will be executed in order to limit the depths of a search.

But other than that we want the REST consuming client to be able to execute any search without us having to predefine how a certain parameter and a certain control sequence will get translated into a search.


Right now I’m trying some semi automatic solution building on Mysemas QueryDSL. It allows me to predefine the where columns and sort columns and I’m working on a simple string comparison to detect things like ‘_like’, ‘_loe’, … in a parameter and then activate the corresponding predefined part of the search. Not much different from an SQL String except that it’s SQL injection proof an type save.

However I still have to tell my search object that it should be able to potentially handle a query “look for a person with name like ‘???'”. Right now this is okay as we only consume the REST resource internally and isolate the actual search creation quite well. If we need to make a search do more we can just add more predefinitions for now. But should we make our REST resources public at some time in the future that won’t be so great.


So we’re wondering, there has to be some framework or best practice or recommended solution to approaching this. We’re not the first who want this. Redmine for example offers all of its resource via a REST interface and I can query at will. Or facebook with its Graph API. I’m sure those guys didn’t just predefine all possibilities but rather created some generic grammar. We’d like to save as much as possible on that effort and use available solutions instead.

Like I said, we’re using Hibernate so an SQL or HQL solution would be fine or anything that builds on entities like QueryDsl. (Also there’s the security issue concerning SQL injection)

Any suggestions? Ideas? Will we just have to do it all ourselves?

  • 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-06-12T01:15:47+00:00Added an answer on June 12, 2026 at 1:15 am

    From a .NET perspective the closest thing I can think of would be a WCF data service.

    Take a look at the uri-conventions specified on the OData website. There is some good information on the section on 4.5 Filter System Query Option. You’ll notice that a lot of the examples on this site are .NET related, but there are other suggestions for getting this to work with Java.

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

Sidebar

Related Questions

I have a Java web app that offloads some environment specific settings (Hibernate configurations,
I have a Java web app running on Tomcat 7 that is using JDBC
I have a web-app with a Java back-end that uses Tomcat jdbc-pool for database
I have a java web app running under Spring 2.5.6, Hibernate 3.4 (with Hibernate
I have a java web app running in spring web flow framework and hibernate
I have a typical Flex-based application that was written to use a Java/Hibernate/MySQL backend.
I work on a Java web based app that uses both Jackrabbit and Hibernate
I have a Java web app that I'm developing, using JBoss Seam as the
I'm using Maven 2 and Hibernate for a Java web app. I have a
I have a scenario in a java web app, where a random hexadecimal value

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.