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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:00:39+00:00 2026-05-25T02:00:39+00:00

If I debug, I can see that the string I’m building is and (

  • 0

If I debug, I can see that the string I’m building is

and ( property1 , property2 ) in ( values (0, 5) , (3, 4) )

but Hibernate thinks it’s better to transform it like this

and (
    (
    tabAlias.COLUMN1 , tabAlias.COLUMN2
    ) in (

    values
    (0, 5) ,
    )
)

I don’t mind the extra ( ) Hibernate added, but I don’t understand why after (0, 5) , it doesn’t appear (3, 4) ?? Why is Hibernate tryin’ to be smart and mess things up?

ps: I’m using DB2 9
ps2: don’t tell me to use criteria query cuz’ I’m fixing somebodyelse’s code, I don’t want to rewrite it all.
ps3: I know this isn’t portable, but I don’t care.

Any workarounds ? I also don’t want to use multple OR clauses to simulate this.

  • 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-25T02:00:40+00:00Added an answer on May 25, 2026 at 2:00 am

    HQL is not SQL. Hibernate parses the HQL and builds a new SQL query based on it. I suspect what you’re trying to do is not supported in HQL. Normally you would get an error but for some reason it’s accepting your HQL and generating invalid SQL.

    If you want to use SQL you can get a connection with Session.connection().

    You may be able to get your syntax working by modifying it a bit. This may help:
    http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/queryhql.html#queryhql-tuple

    [EDIT]

    Looks like this person experienced the same problem and switched to using createSQLQuery() to solve it. It must be a bug in hibernate.

    https://forum.hibernate.org/viewtopic.php?f=1&t=982785&view=previous

    [EDIT]

    Shouldn’t your query be:

    and ( property1 , property2 ) in ( values ((0, 5) , (3, 4)) )
    

    Note the extra parens.

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

Sidebar

Related Questions

I am populating combo box from database. In debug i can see that the
How can i see in debug time the value of a el expression? i.e.
I am a CSS newbie. Is there a tool that can help debug CSS
My understanding is that with crash dump of debug build you can get the
Is there any profiler sort of tool which can debug which javascript/object in the
In accordance with the steps from MSDN , I can debug .net framework source
0xE8000003A Error: I have developed AppOne for several weeks. I can debug on both
I have acustom sharepoint page. on my machine I can debug the code normaly
I have a messy stored procedure which uses dynamic sql. I can debug it
How can I debug a .NET setup project?

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.