When I try to execute the following HQL query:

Query  query =  getSession().createQuery("update XYZ set status = 10");
query.executeUpdate();

I get this exception:

Exception in thread "main" org.hibernate.QueryException: query must begin with SELECT or FROM: update

EDIT:
I also tried following .But it doennot work either.

org.hibernate.Query  query =  getSession().createQuery("update XYZ t set t.status = 10");

EDIT2: Making changes in hinbernate.cfg.xml solved my problem Earlier i was using

setting hibernate.query.factory_class"   = org.hibernate.hql.classic.ClassicQueryTranslatorFactor

Now am using following property

<property name="hibernate.query.factory_class">org.hibernate.hql.ast.ASTQueryTranslatorFactory</property>
Edit
Report