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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:35:51+00:00 2026-05-16T06:35:51+00:00

I was trying to fire hql for some reporting purpose in my JPA based

  • 0

I was trying to fire hql for some reporting purpose in my JPA based application.
The following query that I tried kept conking out on startup (Since I had given it as a NamedQuery, it was checked for syntax at startup).

Incorrect Query:

SELECT t FROM Table_1 tb1 
INNER JOIN 
Table_2 tb2
where tb1.name = 'someName';

After lot of permutations and combinations (and digging through the other parts of the query, which I suspected earlier), I realized the problem lied in the “t“. Instead of the query above, the correct query should have been…

SELECT tb1 FROM Table_1 tb1
INNER JOIN 
Table_2 tb2
where tb1.name = 'someName';

Notice that HQL expects the tb1 to be same as the Table shortname “tb1“

The tableName shortform and the select mismatch only resulted in the issue that I was facing. Surprisingly, hibernate/JPA does not give an error in the stack, but the deployment keeps on running through and I need to ultimately kill the java process to get out of it.

Hope this helps someone.

It would great, if somebody could also reason this behaviour.

Thanks!!

  • 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-16T06:35:52+00:00Added an answer on May 16, 2026 at 6:35 am

    The best way to deal with such statements it make it a PRACTICE to put the “Variable” in the SELECT clause same as the table Alias.
    That is instead of

    "SELECT t from Table_1 T1" 
    

    make a statment like

    "SELECT T1 from Table_1 T1"
    

    Hope that helps someone in the future.

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

Sidebar

Related Questions

Trying to find some simple SQL Server PIVOT examples. Most of the examples that
I am trying to fire an event on the right and left arrow key
I'm trying to get an event to fire whenever a choice is made from
I'm trying to teach Komodo to fire up IDLE when I hit the right
I'm trying to get a specific asp:button onclick event to fire when I press
I am trying to get a dynamically loaded LinkButton to fire a postback event,
Trying to setup an SSH server on Windows Server 2003. What are some good
Trying to make a make generic select control that I can dynamically add elements
Trying to get my css / C# functions to look like this: body {
Trying to keep all the presentation stuff in the xhtml on this project and

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.