0
java.lang.Illegalargumentexception: org.hibernate.hql.internal.Ast.Querysyntaxexception: Unexpected token: SUM near line 1, column 1 [SUM(e.quantidade) FROM br.com.pmro.coad.modelo.Stock and Join fetch e.products Prod GROUP BY id id]
//CONSULTATION 1 - WORKING
return this.em.createQuery("FROM Estoque e join fetch
e.produtos",Estoque.class).getResultList();
//CONSULTATION 2 - WORKING
return this.em.createQuery("FROM Estoque e join fetch e.produtos prod
GROUP BY prod.id",Estoque.class).getResultList();
//CONSULTATION 3 - GIVING DICK
return this.em.createQuery("SUM (e.quantidade) FROM Estoque e join fetch e.produtos prod GROUP BY prod.id",Estoque.class).getResultList();
I would like to return the whole object and not just the sum.
– Alexandre Luiz Dos Santos
How you used group by so put in SELECT Prod,SUM(e. quantity)
– Wesley Ventura
I managed to solve but in a very different way. Thank you for having given this help anyway.
– Alexandre Luiz Dos Santos