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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T23:22:03+00:00 2026-05-21T23:22:03+00:00

I am running a hibernate query which is returning an Object instead of the

  • 0

I am running a hibernate query which is returning an Object instead of the correct entity object. The statement is as follows:

public List getPriorBids(String rfpCD, String carrierCode) {
    String sqlString =  " SELECT inland_cd, " +
                                "rfp_cd, " +
                                "carrier_cd, " +
                                "port_cd, " +
                                "max(iteration_nb) as iteration_nb " +
                        " FROM care.inland_bid " +
                        " WHERE rfp_cd = :rfpCode " +
                        "   AND carrier_cd = :carrierCode " +
                        " GROUP BY inland_cd, rfp_cd, carrier_cd, port_cd " +
                        " ORDER BY inland_cd, carrier_cd"; 
    SQLQuery sqlQuery = session.createSQLQuery(sqlString);
    sqlQuery.setString("carrierCode",carrierCode);
    sqlQuery.setString("rfpCode", rfpCD);
    sqlQuery.addEntity(Bid.class);
    List bids = sqlQuery.list();
    return bids;
   }

Clearly I am trying to store it as a Bid object. I have another object as well which I should be storing it as but I get an error that the column name cannot be found, despite double and triple checking column names to make sure they match.

  • 1 1 Answer
  • 1 View
  • 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-21T23:22:04+00:00Added an answer on May 21, 2026 at 11:22 pm

    Query.list() returns a raw List object, not a generic List.

    You should just be able to cast it to List<Bid>, and ignore the unsafe cast warning.

    I think you are confusing a method which returns a raw List with the actual run-time type of the List elements being Object. Just because the compile-time signature of List.get(i) returns an Object does not mean that the actual type of the element returned is Object at run-time.

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

Sidebar

Related Questions

I'm running NHibernate 2.1.2.4000 but there's no Query() method off my session... Which version
Getting Exception while running query using Criteria API org.hibernate.QueryException: could not resolve property: com
I'm encountering a problem running a query or detached criteria on an embedded object.
I am new to Hibernate. I have an exception while running an Hibernate-based application.
We have a Tapestry-Spring-Hibernate webapp running on Tomcat 6, handing about a few 1000
I have an odd problem where Hibernate is running more queries than I've asked
Running JBoss 5.1, with Hibernate as the JPA provider. Backed with SQL Server 2008.
I'm running into a problem with Hibernate where when trying to delete a group
I have a DB running on Oracle. I use Hibernate for data access. I
I'm having trouble starting a transaction with Hibernate and MySQL while running in JUnit.

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.