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

  • Home
  • SEARCH
  • 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 6050425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:41:13+00:00 2026-05-23T07:41:13+00:00

I have this situation Session session = sessionFactory.openSession(); ArrayList<String> city; // in city array

  • 0

I have this situation

    Session session = sessionFactory.openSession();
        ArrayList<String> city;
       // in city array i have    "United States-Alabama-Anniston"
    Criteria  crit = session.createCriteria(Candidate.class);


    crit.createAlias("candidateInfo", "ci");

    crit.add(Restrictions.in("ci.city", city));
            List rsList = crit.list();

Now this above thing work fine if i have the value “United States-Alabama-Anniston” in my database but the problem is in my database its only “Anniston”

do any one have any idea how to get the match if there’s only “Anniston” in my database and i want to check it with “United States-Alabama-Anniston” which is in the ArrayList.

thanks

  • 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-23T07:41:13+00:00Added an answer on May 23, 2026 at 7:41 am

    If I understand correctly from comment, you have values in the string that may consist of country,state and the city separated by ‘-‘. In this case and if format with ‘-‘ is guaranteed, your best and most efficient choice would be to just walk over array and copy part after ‘-‘ to separate array that you can use in in clause.

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

Sidebar

Related Questions

I have a situation, I have a session bean with list, this list I
So, I have this situation where I need to see if an object is
During coding I frequently encounter this situation: I have several objects ( ConcreteType1 ,
The situation is this: You have a Hibernate context with an object graph that
This is often situation, but here is latest example: Companies have various contact data
I know questions of this kind have been asked before, but my situation differs
I have somehow misconfigured fingers. This leads to a very annoying situation. I select
Here is the situation. This small company I'm working with wants to have a
I have this gigantic ugly string: J0000000: Transaction A0001401 started on 8/22/2008 9:49:29 AM
I have to save the following variables to a database: string PoliciaID = Session[username];

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.