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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:44:54+00:00 2026-06-03T01:44:54+00:00

In one of my applications, I am to execute a search on multiple fields/columns.

  • 0

In one of my applications, I am to execute a search on multiple fields/columns. Its an Advanced Search and there are over 20 fields using which a user can search for results. For example, a user can search for bookings based on

  1. Booking Id
  2. Passenger Name
  3. Passenger Age
  4. From Location
  5. To Location
  6. Booking Status
  7. Name of the Airline

and 13 such fields.

I am trying to figure out if

  1. Hibernate Search can and should be used here? If so, how? I was unable to find an example for such a complex search using Hibernate Search.

  2. Instead of Hibernate search, I can simply use Hibernate and maybe design a multi-threaded search depending in the number of parameters. Would that be a good idea?

  3. Is it possible to use Hibernate Filters here?

Can someone please provide inputs or reference links?

  • 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-03T01:44:57+00:00Added an answer on June 3, 2026 at 1:44 am

    For these kinds of queries, I generally use a Criteria query with a form object. I then check for null in each passed form field, and if not null, then add another Restriction into the query, using that field. Using a Criteria query keeps the Java code very clean and eliminates messy string concatenation. An example for your case:

    // Form object
    public class bookingSearchForm {
        private String bookingId;
        public getBookingId()...
        public setBookingId()...
    }
    
    // Hibernate
    Criteria criteria = getSession().createCriteria(Booking.class);
    if(form.getBookingId() != null) {
        criteria.add(Restrictions.eq("bookingId", form.getBookingId()));
    }
    criteria.list();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In one of my applications a user can upload images and archives (ZIP, RAR).
In one of my applications I have a class which is responsible for user
One of our applications is started suddenly terminate with error Can't load file or
I am designing a REST api for one of my applications & considering using
I spend a lot of time debugging applications in Eclipse using JPDA. There are
I have a couple of applications that I would like to execute one following
I'm using the LocalMessageReceiver and LocalMessageSender classes to communicate between two Silverlight applications (One
One of our applications is exhibiting poor network behavior on Vista due to the
One of my applications has property of images as background of Cells in UITableView,
In one of my applications I am providing the users the ability to issue

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.