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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:15:08+00:00 2026-06-12T15:15:08+00:00

Lets supose that I have 3 abstract super classes: SuperA , SuperB and SuperC

  • 0

Lets supose that I have 3 abstract super classes: SuperA, SuperB and SuperC.
Lets supose that each of theses super classes had a lot of more specific implementations, and all the superclasses are annotated with @Inheritance(strategy = InheritanceType.JOINED).

More specific:

  • Aa <- SuperA and has a List of SuperB (the bbs property);
  • Bb <- SuperB and has a List of SuperC (the ccs property);
  • Cc <- SuperC and has a foo property.

Then, when I try a query like the following, I got an error saying that it could not find the property foo in the type SuperC. Bb has a list of the abstract type, and I can’t change that. So, I do not know how to make the query works.

select a from Aa a left outer join a.bbs b where b.ccs.foo = :foo

Any tip will help. Thanks in advance.


Edit:

BTW: the exception:

org.hibernate.exception.SQLGrammarException: Unknown column 'cc3_1_.foo' in 'where clause'


Edit 2:

I look for JPA docs, and found something that could work, if I’m not using Hibernate.


Edit 3:

I change it to use two SQL’s. First, I find the id of the C based on the foo property, then I just do the query comparing with the id.

The problem here, is that I have to do 2 SQL’s for every time I want this… but, at least it works.

  • 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-12T15:15:09+00:00Added an answer on June 12, 2026 at 3:15 pm

    You need one more join for the list of Cc’s then it should be fine:

    select a from Aa a left outer join a.bbs b join b.ccs c where c.foo = :foo
    

    as ccs is a list you can’t “dereference” it’s property this way, if you could you wouldn’t need joins, you could simply write: a.bbs.ccs.foo but this is not the case so you need to join the lists as I wrote above.

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

Sidebar

Related Questions

I have many solutions, each solution containing at least one project (lets supose they
First suppose that I have an abstract class, let's call it AbstractClass. Suppose public
Lets suppose that I have the following simple query var q = from p
Lets suppose that I have some pages some.web/articles/details/5 some.web/users/info/bob some.web/foo/bar/7 that can call a
Lets suppose that I have a Category table with a column that holds the
Let's suppose that I have 2 processes in Erlang, and each process has a
Lets suppose i have a super class WorkStation , and two subclass StationNormal ,
Here is the question's plot: suppose I have some abstract classes for objects, let's
What I want to do: lets suppose I have a TStringStream that just read
Suppose I have 2 cells that are merged, lets say Sheet1!$A$1:$B$1 . And lets

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.