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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:01:52+00:00 2026-06-04T19:01:52+00:00

#My doubt is the partId in Product table can be null ,so if the

  • 0

#My doubt is the partId in Product table can be null ,so if the partId is null I’m not able to see the product. If my Product Table has 11 entries and 2 entries have partId as null , Iam able to see only 9 entries

 String hql = "from " + Product.class.getName() + " bs, "
                + Part.class.getName() + " dm, "
                          + Manufacturer.class.getName() + " m where "
                          + " m.id = bs.manufacturerId and dm.id = bs.partId ";
========================================

The ouput has to be like this
productName | PartName | Manufactuer Name

  • 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-04T19:01:53+00:00Added an answer on June 4, 2026 at 7:01 pm

    You need to do left joins instead of inner joins. But this is only possible if your entities are associated together instead of containing each other’s IDs.

    As is, it’s plain impossible with HQL.

    Given your query, you probably should have a ManyToOne between Product and Manufacturer, and a ManyToOne between Product and Part.

    Also, your query would be much more readable if you didn’t concatenate class names and if you used proper alias names:

    String hql = "from Product product, Part part, Manufacturer manufacturer"
                 + " where manufacturer.id = product.manufacturerId"
                 + " and part.id = product.partId";
    

    Once the associations exist, the query should just be

    String hql = "select product.name, part.name, manufacturer.name"
                 + " from Product product"
                 + " left join product.part part"
                 + " left join product.manufacturer manufacturer";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have one Doubt In MVC Architecture we can able to pass data from Controller
I have a little doubt, I want to create a table that had a
I doubt I am the only one who has come up with this solution,
i have doubt about how can i iterate into a group of div, my
I have a doubt, I will appreciate if you can clear it . COOKIES
I have a doubt about how I can check an URL like this: http://your.url/set_new_password.php?userid=564979&code=54c4a2767c2f485185ab72cdcf03ab59
No doubt I'm missing something really simple here but I just can't see the
No doubt this might be a duplicate question but I am not able to
Basic doubt...If QTP generates vbscript code as we record actions, can't we directly write
No doubt elements of this question have been asked before, but I'm having trouble

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.