Salve,
ho un metodo di questo tipo:
public int reserveRequests(String label, int status, int owner, int count) {
Date dt;
Query query;
dt = new Date();
String query_string = "UPDATE Esbinteraction e SET e.owner =wner WHERE e.label = :label and e.owner = 0 and status = :status";
query = em.createQuery(query_string);
query.setMaxResults(count);
query.setParameter("owner", owner);
query.setParameter("status", status);
query.setParameter("label", label);
return query.executeUpdate();
}
in cui, il metodo setMaxResults non funziona, trattandosi di una UPDATE e non di una SELECT. Siccome lavoro con MySQL, non posso usare nella query_string l'istruzione rowCount (usata su ORACLE). Con MySQL occorrerebbe utilizzare il comando limit che però nella sintassi di hibernate non viene riconosciuto.
Come posso risolvere la cosa? Grazie.

wner WHERE e.label = :label and e.owner = 0 and status = :status";
Rispondi quotando