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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:27:35+00:00 2026-05-31T15:27:35+00:00

I am having some problem with the setParameterList api of hibernate. I am trying

  • 0

I am having some problem with the setParameterList api of hibernate.

I am trying to pass in a Collection to a SQLQuery and doing an “in” clause search.The records exists in the DB and doing a raw query, I am able to retrieve them or if I just replace them in the same Hibernate SQL like emp.emp_name in ('Joe','John'), I am able to get the desired result set. I am confused as to why would Hibernate fail to replace the Collection in place of the named parameter. Here is the code :

session.createSQLQuery("select emp_id as id from emp where emp.emp_name in (:empNames)")
       .addScalar("id",Hibernate.INTEGER)
       .setParameterList("empNames",new String[]{"Joe","John"})
       .list()

I have looked at the Hibernate Documentation for setParameterList but I am not able to reason out this particular behavior.

  • 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-31T15:27:37+00:00Added an answer on May 31, 2026 at 3:27 pm

    I suspect the problem is precisely because you’re using createSQLQuery. The single parameter here needs to be changed into multiple parameters in the real SQL, but by using a “raw” query you’re telling Hibernate not to mess with the SQL.

    Can you use a “normal” Hibernate query instead?

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

Sidebar

Related Questions

I am having some problem here. I am trying to develop a flash database
Having some problem getting my program to sleep What im trying to do is
Im trying to make an app with geoDjango but I'm actually having some problem
I am trying to learn mysql and having some problem with updating/adding data to
I'm having some problem with MKMapView / annotations / UINavigationController. Basically, i manage my
I am working on a windows form project and having some problem with UserControl
I'm having some difficulties with the following problem: I'm making a little game where
I've been having some difficulty in understanding the source of a problem. Below is
I am having some trouble with this code . The problem is when i
Hey, I'm having some difficulty with CSS and IE6 compatibility. URL : http://bit.ly/dlX7cS Problem

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.