Olá, bom dia. Tenho este código que funciona legal:
public Evento ultimo(){
String hql = "from Evento qhere id = 100";
Query query = getSession().createQuery(hql);
return (Evento) query.uniqueResult();
}
Porém, ao tentar pegar o último registro (que é o que me interessa), dá erro:
public Evento ultimo(){
String hql = "from Evento qhere id = max(id)";
Query query = getSession().createQuery(hql);
return (Evento) query.uniqueResult();
}
Erro:
could not execute query
Alguém pode me ajudar?
Grato, Carlos.