Pessoal ao fazer o seguinte select gera a seguinte exceção.
public class AlbumDAO extends Dao {
public List<Album> buscarAlbunsDoCliente(Integer idCliente) throws Exception{
em = emf.createEntityManager();
List<Album> albuns = new ArrayList<Album>();
try {
em.getTransaction().begin();
Query consulta = em.createNativeQuery("SELECT * FROM album WHERE cliente_id = :id");
// Ou JPQL : Query consulta = em.createQuery("SELECT albuns FROM Album album where album.cliente.id = :id");
consulta.setParameter("id", idCliente);
albuns = consulta.getResultList();
em.getTransaction().commit();
} catch (Exception e) {
e.printStackTrace();
em.getTransaction().rollback();
throw e;
} finally {
em.close();
return albuns;
}
}
}
GRAVE: java.lang.IllegalStateException: No data type for node: org.hibernate.hql.ast.tree.IdentNode
\-[IDENT] IdentNode: 'albuns' {originalText=albuns}
at org.hibernate.hql.ast.tree.SelectClause.initializeExplicitSelectClause(SelectClause.java:156)
.............
alguem?