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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:53:40+00:00 2026-06-15T18:53:40+00:00

I am facing the problem on update hql query on hibernate. Here is my

  • 0

I am facing the problem on update hql query on hibernate.

Here is my following class:

    --session configuration
     ExamResults examResults = new ExamResults();
     examResults.setTitle("cbse board jee");
     examResults.setId(2);
     String hql = "UPDATE EXAMRESULTS SET TITLE=:TITLE WHERE ID=:ID";
     Query query = session.createQuery(hql);
     query.setParameter("TITLE", examResults.getTitle());
     query.setParameter("ID", examResults.getId());
     int result = query.executeUpdate();
     System.out.println("Rows Effected=>"+result);


     session.save(examResults);

     tx.commit();

   }
}

On running the class, i am getting following exception:

Exception in thread "main" org.hibernate.hql.ast.QuerySyntaxException: EXAMRESULTS is not mapped [UPDATE EXAMRESULTS SET TITLE=:TITLE WHERE ID=:ID]
    at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:181)
    ...

Also my bean class is here:

@Entity
@Table(name="EXAMRESULTS")
public class ExamResults implements Serializable{

    private int id;
private String title;
private String body1;
private String body2;
private Date resultdate;
private String affiliation;
private int isactive;
private String url;
private String imageurl;
//private CommonsMultipartFile imageurlimg;
private String metatitle;
private String metadescription;
private String metakeywords;
private Date createddate;


    --getters & setters

What should be correct approach to resolve problem?

  • 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-15T18:53:41+00:00Added an answer on June 15, 2026 at 6:53 pm

    Instead of EXAMRESULTS try using ExamResults i.e. the class name of your entity. You need to use class name in your HQL queries instead of table name. So update the query to:

    UPDATE ExamResults e SET e.TITLE=:TITLE WHERE e.ID=:ID
    

    The HQL documentation mentions:

    With the exception of names of Java classes and properties, queries
    are case-insensitive. So SeLeCT is the same as sELEct is the same as
    SELECT, but org.hibernate.eg.FOO and org.hibernate.eg.Foo are
    different, as are foo.barSet and foo.BARSET.

    Documentation: http://docs.jboss.org/hibernate/orm/4.1/devguide/en-US/html/ch11.html#d5e2551

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

Sidebar

Related Questions

I am facing a problem - can not update the price of the variant
I am facing problem to get variable from query string. I have used htaccess
I'm facing a problem here, I was using this library UIDevice with UniqueIdentifier for
I'm facing the following problem and don't have an answer to it: We have
Like any other question I am facing problem whenever I am trying to UPDATE
We are facing a problem with lastest JRE 6 update 22 and 23. The
i'm facing a problem, currently i'm having a update panel in my master page
I'm currently facing a problem in my Cherrypy application. Im my own custom session
I'm facing this problem and could not get through by any means. Here is
I am facing a problem with Hibernate (4.3.0) where as unidirectional @OneToMany returns duplicates.

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.