I run following code intend to update the least record in the table on Hibernate 3.6.7 final (JPA 2.0?) :
Query query = em.createQuery("UPDATE MyTable a SET a.isEnable=1 WHERE a.isEnable=0 ORDER BY a.id DESC").setMaxResults(1);
query.executeUpdate();
but hibernate ignores ORDER BY
when generating sql.
Is ORDER BY
for SELECT
use only in JPQL? How to execute UPDATE
query with ORDER BY
in JPA?
thanks for any help.