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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:19:31+00:00 2026-06-02T05:19:31+00:00

I am trying to return a set of objects that are not part of

  • 0

I am trying to return a set of objects that are not part of a collection like this:

    TypedQuery<Extra> q = em
            .createQuery(
                    "SELECT e FROM Extra e, Arrangement a WHERE "
                        + "a.id = :arrid AND e NOT MEMBER OF a.extras",
                    Extra.class);
    q.setParameter("arrid", a.getId());
    return q.getResultList();

But I get a bad SQL out of this:

Caused by: org.h2.jdbc.JdbcSQLException: Subquery is not a single column query; SQL statement:
select extra0_.code as code427_, extra0_.edition_number as edition5_427_,
extra0_.totalCost as totalCost427_, extra0_.unitCost as unitCost427_,
extra0_.units as units427_ from extra_arrangements extra0_
cross join arrangements arrangemen1_
where arrangemen1_.id=? and
((extra0_.code, extra0_.edition_number) not in
  (select extra3_.code, extra3_.edition_number
   from arrangements_extra_arrangements extras2_, extra_arrangements extra3_
   where arrangemen1_.id=extras2_.arrangements_id and
   extras2_.extras_code=extra3_.code and
   extras2_.extras_edition_number=extra3_.edition_number)) [90052-161]

The thing is that this other query works as expected:

    TypedQuery<Exhibitor> q = em.createQuery(
        "SELECT e FROM Exhibitor e, Edition ed WHERE ed.number = :ednum AND "
        + "e NOT MEMBER OF ed.exhibitors",
        Exhibitor.class);
    q.setParameter("ednum", e.getNumber());
    return q.getResultList();

The only difference being that Exhibitor has a single column id, whereas Extra has a composite key:

@Entity
@Table(name = "exhibitors")
public class Exhibitor implements Serializable, Comparable<Exhibitor> {

    @Id
    private int id;
    @Column(length = 100)
    private String code;
    @ManyToMany
    private List<Edition> edition;
    ...
}

Extra:

@Entity
@Table(name="extra_arrangements")

public class Extra implements Serializable {

    @EmbeddedId
    private ExtraCode id;
    private double unitCost;
    private double units;
    ...
}


@Embeddable
public class ExtraCode implements Serializable {

    private String code;
    @ManyToOne
    private Edition edition;

    //Getters and setters omitted
}

Any idea what I might be doing wrong and how to fix it?

  • 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-06-02T05:19:33+00:00Added an answer on June 2, 2026 at 5:19 am

    I think it’s same problem as this one.
    H2 does not currently support that style of IN query.

    Problematic place in sql-query:

      AND (
        (
          extra0_.code,
          extra0_.edition_number
        ) NOT IN 
        (SELECT ...)
      )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to return the value that a $ajax call returns, from a function
So I'm trying to find a way to return a very large result set
Im trying to return a SimpleQuery list that queries a single table and uses
Hi I am trying to return a collection which may potentially have null date
I'm trying to return a reference to an object, not pass it by value.
I'm trying to return a JSON response from a Django view call via an
i'm trying to return a custome object from a web service object returned only
I have a Set object and I use this set to ensure that when
Assume that I have a set of objects that need to be analyzed in
I am trying to use a Canvas to display objects that have world location

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.