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

The Archive Base Latest Questions

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

I am using hibernate to fetch rows from the table. List<Work> W= sessionFactory.getCurrentSession().createSQLQuery(Select *

  • 0

I am using hibernate to fetch rows from the table.

List<Work> W= sessionFactory.getCurrentSession().createSQLQuery("Select * from T_WORK ").addEntity(Work.class).list();

This query works fine.

But the below query is not working fine.

List<Work> W= sessionFactory.getCurrentSession().createSQLQuery("Select * from T_WORK WHERE STATUS = 5 ").addEntity(Work.class).list();

I am getting a error as .

could not execute query

Caused by: java.sql.SQLException: Invalid column name
        at oracle.jdbc.driver.OracleStatement.getColumnIndex(OracleStatement.java:3711)
        at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:2763)
        at oracle.jdbc.driver.OracleResultSet.getTimestamp(OracleResultSet.java:512)
        at org.apache.commons.dbcp.DelegatingResultSet.getTimestamp(DelegatingResultSet.java:300)
        at org.apache.commons.dbcp.DelegatingResultSet.getTimestamp(DelegatingResultSet.java:300)
        at org.hibernate.type.descriptor.sql.TimestampTypeDescriptor$2.doExtract(TimestampTypeDescriptor.java:62)
        at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:64)
        at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:254)
        at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:250)
        at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:230)
        at org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:331)
        at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2283)
        at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1527)
        at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1455)
        at org.hibernate.loader.Loader.getRow(Loader.java:1355)
        at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:611)
        at org.hibernate.loader.Loader.doQuery(Loader.java:829)
        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
        at org.hibernate.loader.Loader.doList(Loader.java:2542)

I am using Oracle and status column is of the number datatype.

In the workitem class

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "STATUS_CODE", nullable = false)  
private Status status;

Where am i wrong?
Thanks in advance.

How i can achieve this?

  • 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-17T06:11:23+00:00Added an answer on June 17, 2026 at 6:11 am

    You are using native SQL query. That means, you should use SQL names of your fields. So use STATUS_CODE instead of STATUS.

    i.e. ...createSQLQuery("Select * from T_WORK WHERE STATUS_CODE = 5 ")...

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

Sidebar

Related Questions

Using hibernate, how can I persist a class with a List<String> field? Consider the
I am using Hibernate with spring. I have a model-class like this. @Entity @Table(name
I am using hibernate. I am using the given query to fetch information from
I am using hibernate detached criteria to get the results from a table (Oracle
I am using Hibernate and I have these two classes. public class ApplicantYear{ @ManyToOne(fetch
I want fetch last record using hibernate criteria Can u help me?
When using hibernate to retrieve data from Oracle 11g DB using either org.hibernate.dialect.Oracle10gDialect or
when using hibernate with spring, can someone explain how the session unit of work
I am using hibernate and i want to display only those records of table
I have a requirement to fetch selected rows from Oracle database based on ids

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.