In the handouts I read and tutorials I followed Criteria
is more used, however I identified myself more with HQL
. But I have the following doubt, everything done with Criteria
can do with HQL
?
HQL example:
//Select * from Suspensao
@NamedQueries({
@NamedQuery(name = "Suspensao.listar", query = "SELECT suspensao FROM Suspensao suspensao") })
Then on DAO:
Query consulta = sessao.getNamedQuery("Suspensao.listar");
lista = consulta.list();