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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:22:13+00:00 2026-06-17T08:22:13+00:00

I am faced with very strange problem, and can’t find a way to resolve

  • 0

I am faced with very strange problem, and can’t find a way to resolve it. I wrote the following HQL in intellij’s HQL Console

update NewsEntity ne set ne.main=false where ne.main=true

StackTrace

java.lang.IllegalArgumentException: node to traverse cannot be null!
 at org.hibernate.hql.ast.util.NodeTraverser.traverseDepthFirst(NodeTraverser.java:31)
 at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:254)
 at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:157)
 at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
 at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
 at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
 at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
 at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
 at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
 at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
 in RemoteSessionImpl.createQuery(RemoteSessionImpl.java:50)
 in RemoteUtil.executeWithClassLoader(RemoteUtil.java:122)
 in RemoteUtil$2$1.invoke(RemoteUtil.java:81)
 in HibernateEngine.createQuery(HibernateEngine.java:142) 

When I write a delete query I don’t have the same problem.

I have based this query around the following article HQL update query. But, can’t seem to figure out why I am still having this 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-17T08:22:15+00:00Added an answer on June 17, 2026 at 8:22 am

    The idea of an ORM like Hibernate is to avoid such update queries.
    You’ve just to load the object from the db, change the field and then Hibernate will update the object for out.

    Query query = session.createQuery("from NewsEntity ne where ne.main = true");
    NewsEntity newsEntity = (NewsEntity) query.uniqueResult();
    newsEntity.setMain=false;
    //Hibernate will update the object
    

    If there’re more objects:

    List<NewsEntity> newsEntities = (List<NewsEntity>) query.list();
    for(NewsEntity entity : newsEntities)
    {
     entity.setMain=false;
    }
    

    Hibernate also supports DML statements, so to do an update query you should do:

    Query query = session.createQuery("your update query");
    int result = query.executeUpdate();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very big problem and can't seem to find anybody else on
I recently faced a very strange problem. Compilation of our products includes signing the
When trying to recreate an InterpolationFunction produced by NDSolve I faced very strange problem
I faced a very strange problem when developing on PHP and MySQL. I had
i just faced a very strange problem today. My Application Structure is: /app -
I've faced a problem... I can not find a good and easy to understand
We were faced with very strange issue that made us crazy. Sometimes newly created
I faced a very wierd problem that in my db i set my id
I have faced a very strange situation here. I am accessing database (MDB) through
We faced a very strange issue (really strange for such mature product): how to

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.