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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:48:51+00:00 2026-05-21T20:48:51+00:00

i really can not find enough documentation on hibernate IN keyword, when applied on

  • 0

i really can not find enough documentation on hibernate IN keyword, when applied on search within a collection of some object. I have strange problem, I have a hql query:

    FROM Contact co, IN (co.categories)categories WHERE categories.name = ?

In i was expecting list of Contacts ofcourse. But something is wrong with it, because it is not returning list of Contact objects, but list of Object[]????? Is it syntax or this is totally wrong??

Here are mapping parts:

     <set lazy="false" name="categories" table="ContactCategory">
        <key column="id" foreign-key="fk_contact_category" />
        <many-to-many class="Category" column="catid"
            foreign-key="fk_contact_category2" />
    </set>

     <class name="Category">

    <id column="catid" name="Id" type="long">
        <generator class="sequence" />
    </id>
    <property length="50" name="name" type="string" />  
</class>

Important thing to mention: This query is made with the query builder. This is printout of one of generated queries where its failing. Very weird is that – i am getting the correct number of objects in this list, I check the database and number is correct with given parameters, but I dont get Contact objects, but some Object arrays in the List.

Appreciate all the help

  • 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-21T20:48:51+00:00Added an answer on May 21, 2026 at 8:48 pm

    You need to add SELECT co

    so that your Query is SELECT co FROM Contact co, IN (co.categories)categories WHERE categories.name = ?

    The SELECT co is necessary, to tell Hibernate which one item it should return per result set line.



    SELECT co FROM Contact co LEFT JOIN co.categories cat WHERE cat.name = ?
    I have seen the IN keyword only in the Where – clause so far. In Stuff like this,

    FROM catagories cat WHERE cat.name IN ('HALLO', 'WORLD')

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

Sidebar

Related Questions

I've done some research and I can't really find a preferred way to do
I am stuck! this seems really daft but I can not see where I
Not really getting the point of the map function. Can anyone explain with examples
Can Thread.getContextClassLoader() be null ? The javadoc is not really clear. Should a library
can anybody recommend some really good resources for how to get Apache authenticating users
Java is supposed to be write once, run anywhere and it really can be,
Can I really and truly trust .NET to initialize fields (like ints, structs and
Distributing ASP.NET user controls across different projects can be really useful when you want
Can someone illustrate what really is the difference between the two?
I have some code (which I cannot change) that I need to get working

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.