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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:03:00+00:00 2026-06-14T23:03:00+00:00

I am trying to inner join two tables on one column. From DB side,

  • 0

I am trying to inner join two tables on one column.
From DB side, there’s no mapping as it’s something I don’t want to discuss.

I want to execute HQL query using INNER JOIN and retrieve ROLE objects/results.

Here’s my hql so far

session.createQuery(“from ROLE as role INNER JOIN INVOLVEMENT as involvement ON role.id = involvement.roleid WHERE involvement.id = X”).list();

I see ON is not available on HQL. how do i explicitly tell Hibernate to JOIN on this column only.

I tried below one too

select roleSpec from ROLE as role, INVOLVEMENT as involvement WHERE role.ID = involvement.role_id and involvement.id =27251352

But I am getting ROLE not mapped in exception.

  • 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-14T23:03:01+00:00Added an answer on June 14, 2026 at 11:03 pm

    Please check that your ROLE is indeed a mapped entity.
    In addition, you don’t need to perform “ON” – hibernate knows what is the join column (I know how to define this at JPA ) – so no need to provide it at the statement.
    It should be –

    session.createQuery("from Role as role INNER JOIN Involvement as involvement WHERE involvement.id = X").list();
    

    I assume you have Role class mapped to ROLE table, and Involvement class mapped to Involement table.
    Maybe you used table names by mistake, and this is why you get the “not mapped” error.
    Last time I wrote HQL (and not JPA-QL) I used the following link as reference, it provides all the info needed.

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

Sidebar

Related Questions

I'm trying to create a mysql table from the inner join between two other
I am trying to join two tables like this... SELECT * FROM lists l
I am doing a inner join between two tables where one is an association
I'm trying to execute the following SQL: SELECT * FROM Table2 INNER JOIN (SELECT
I'm trying to delete two tables rows from two different tables at once when
I am trying to join two tables: table A and table B. Table A
I am trying to get a list of products and images from two tables.
I am trying to import data from a large database. I have two tables
I have two tables, one is a Product Customer mapping and another is a
I need to pull data from two tables: Neptune_FN_Analysis and Neptune_prem There will be

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.