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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:09:52+00:00 2026-05-25T00:09:52+00:00

In the QueryDSL library, the com.mysema.query.types.expr.SimpleExpression<T> class has a SimpleExpression.in(CollectionExpression<?, ? extends T>) method

  • 0

In the QueryDSL library, the com.mysema.query.types.expr.SimpleExpression<T> class has a SimpleExpression.in(CollectionExpression<?, ? extends T>) method which is supposed to take an expression which is supposed to return a collection. But I cannot find a way to create an object of type com.mysema.query.types.CollectionExpression<?, ? extends T>.

My query expression looks like this:

QEvent.event.organization.in(expression)

where i want the expression to be something like:

QOrganization.organization.country.in("India", "USA")

But the second expression is of type com.mysema.query.types.expr.BooleanExpression and I am unable to find a way to convert it to com.mysema.query.types.CollectionExpression<?, ? extends T>.

I looked in the QueryDSL API docs but could not find anything relevant.

  • 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-25T00:09:53+00:00Added an answer on May 25, 2026 at 12:09 am

    You can’t convert a BooleanExpression into CollectionExpression, for the same reasons why you can’t convert a java.lang.Boolean into a java.util.Collection. They aren’t compatible.

    What would the following expression mean to you

    QEvent.event.organization.in( 
        QOrganization.organization.country.in("India", "USA"))
    

    Do you maybe try to express something like this?

    QEvent event = QEvent.event;
    QOrganization organization = QOrganization.organization;
    query.from(event)
        .innerJoin(event.organization, organization)
        .where(organization.country.in("India", "USA"))
        .list(event);
    

    Or simpler

    QEvent event = QEvent.event;
    query.from(event)
        .where(event.organization.country.in("India", "USA"))
        .list(event);
    

    I guess what you tried to describe was an Expression using subqueries. Something like this

    query.from(event)
        .where(event.organization.in( subQuery().from(organization)
            .where(organization.country.in("India", "USA")))
        .list(event);
    

    The implementation of subQuery() is Querydsl backend specific. If you use a join then you get a row for each matching event – organization combination and with subqueries you get unique events which have organizations meeting the given constraints.

    Performance differences of join vs subquery are implementation specific.

    Which Querydsl backend do you use? JPA, SQL or something else?

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

Sidebar

Related Questions

I'd like to create query like this with QueryDSL update WorkMessage w set w.totalPrice
I'm trying to setup my project so that I can use querydsl-sql against a
The site only has documentation for JSON, but not the Java client. Is there
I am just beginning with Hibernate Search. The code I am using to do
I'm used to work with Criteria API in Hibernate, and just watched how the
I'm trying to get an average for a count on a groupBy by joining

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.