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 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
  • 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-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 have a problem with a query using hibernate. The entity class EntityClass has
We're running a java/hibernate app going against ORACLE 10g in TESTING. Once in a
I'm running into a performance problem in my SQL using Hibernate's DetachedCriteria. I have
I have a project which I am building with Maven which uses Hibernate (and
Still duking it out with Hibernate... I'm using Hibernate-Annotations instead of hbm.xml files for
I am running an aggregate function in java through hibernate and for some reason
This solution works but performance is lower than expected. A query returning 200K rows
Hi Im running example using hibernate with postgresql 8.4, when i try to add
We're having the classic spring/hibernate/mysql stack running in Tomcat 5.5. Once in a while
Has anyone been able to get an NHibernate-based project up and running on a

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.