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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:10:21+00:00 2026-06-11T05:10:21+00:00

I am using a native sql query where I have a players table to

  • 0

I am using a native sql query where I have a players table to which I join three times, first to get the batsman name, then to get bowler name and then to get the fielder name. Now the first join works, but the next two also return the same name i.e the batsman name.

Here is the sql query

 select 
    del.over_no , 
    del.delivery_no , 
    batsman.sname , 
    outType.name , 
    outBy.sname , 
    fielder.sname , 
    bep.runs, 
    bep.deliveries, 
    bep.fours, 
    bep.sixes

    from delivery del 
    INNER JOIN batsman_performance bep ON del.innings_id=bep.innings_id 
    INNER JOIN ref_player batsman ON del.batsman_id = batsman.id
    INNER JOIN ref_player outBy ON del.bowler_id = outBy.id
    LEFT OUTER JOIN ref_player fielder ON del.fielder_id1= fielder.id
    INNER JOIN ref_out_type outType ON del.out_type_id=outType.id
    and del.out_type_id IS NOT NULL 
    and del.innings_id=:innings_id 
    and bep.player_id = del.batsman_id
    order by over_no, delivery_no;

I am not using aliases for the selected columns because when i did, hibernate threw an exception for whichever column I use an alias

Request processing failed; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query] with root cause
java.sql.SQLException: Column ‘over_no’ not found.

This query is working when I run it on my mysql client and returns the correct dataset but when I run it in my code, the result set somehow overrides the two subsequent joins on ref_player table, leaving me with the batsman name in all three columns, i.e same name in batsman.sname, outBy.sname and fielder.sname columns.

I am stuck here for the last two days, Please any help would be great.

  • 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-11T05:10:22+00:00Added an answer on June 11, 2026 at 5:10 am

    its a pending issue on the Hibernate bug tracking.

    See this ticket

    also in hibernate forums. This clearly shows this is bug a hibernates end.

    See Hibernate Forum Discussion

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

Sidebar

Related Questions

I'm using Spring-orm and HibernateTemplate to execute a native SQL query (DB is Oracle
I have a SQL query, mad in Python using Psycopg2 . The query reads
Is this possible to map a SQL Native query (instead of a table) with
I have an sql query in my controller action (select * from table....where.....et al).
I'm using SQL Server Analysis Studio 2008 to query a Naive Bayes classification model.
CouchDB, version 0.10.0, using native erlang views. I have a simple document of the
UPDATE: I have determined that the SQLClient code times out on the first call,
I'm trying to write a HQL/Criteria/Native SQL query that will return all Employees that
I have been told that SQL Native Client is supposed to be faster than
I'm trying to build a query using HQL and OUTER JOIN s and just

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.