nlista de parâmetros nomeados (cont.)
nList
names = new ArrayList();
nnames.add("JAVA");
names.add("SQL");
nem.createQuery("select
c from Comunidade c where c.nome in (:nlist)").setParameter("nlist", names). getResultList();
n
ngetResultList() carrega as instâncias resultado para o Persistente
Context da aplicação. Já getSingleResult() pode ser usado quando se espera um valor como retorno.
n@SuppressWarnings("unchecked")
nList<Comunidade>
comunidades =
n em.createQuery("from Comunidade c where c.nome = :nome").setParameter("nome", "Java").getSingleResult();
n