Kiedy próbuję wykonać następujące zapytanie: HQLproblem z aktualizacją HQL
Query query = getSession().createQuery("update XYZ set status = 10");
query.executeUpdate();
otrzymuję ten wyjątek:
Exception in thread "main" org.hibernate.QueryException: query must begin with SELECT or FROM: update
EDIT:
Próbowałem również następujące .Ale doennot to działało .
org.hibernate.Query query = getSession().createQuery("update XYZ t set t.status = 10");
EDIT2: dokonywania zmian w hinbernate.cfg.xml rozwiązać mój problem Wcześniej używałem
setting hibernate.query.factory_class" = org.hibernate.hql.classic.ClassicQueryTranslatorFactor
Teraz używam następującą właściwość
<property name="hibernate.query.factory_class">org.hibernate.hql.ast.ASTQueryTranslatorFactory</property>
Jaka wersja hibernować? –
Zobacz https://forum.hibernate.org/viewtopic.php?t=944696&highlight=query+begin+select+delete – kalyan
@Ray toal: Wersja 3.2.5 – akshay