Olá, pessoal!
Tentado a programar esse JPA com Sbu queries e sum, mas ocorreu o erro veja a messagem.
javax.faces.el.EvaluationException: java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Syntax error parsing the query [Select d.nomeDisciplina, n.notaFinal, freq.soma From Disciplina d, Turma t, Notas n, Aluno a, Usuario u, (Select f.notas_aluno, f.notas_turma, SUM(f.f1 + f.f2 + f.f3 +f.f4) as soma from Frequencia f group by f.notas_aluno, f.notas_turma) freq where t.disciplina = d and n.turma = t and n.aluno = a and a.usuario = u and freq.notas_aluno = a and freq.notas_turma = t and u = ?1], line 1, column 110: unexpected token [(].
Internal Exception: org.eclipse.persistence.internal.jpa.parsing.jpql.InvalidIdentifierException
Código da JPA/JQL
public List<Object[]> getListNotasFrequencia(Usuario u) {
EntityManager em = getEntityManager();
List<Object[]> lista = new Vector<Object[]>();
String query = "Select d.nomeDisciplina, n.notaFinal, freq.soma "
+ "From Disciplina d, "
+ " Turma t, "
+ " Notas n, "
+ " Aluno a, "
+ " Usuario u, "
+ " (Select f.notas_aluno, f.notas_turma, SUM(f.f1 + f.f2 + f.f3 +f.f4) as soma from Frequencia f group by f.notas_aluno, f.notas_turma) freq "
+ " where t.disciplina = d "
+ " and n.turma = t "
+ " and n.aluno = a "
+ " and a.usuario = u "
+ " and freq.notas_aluno = a"
+ " and freq.notas_turma = t"
+ " and u = ?1";
try {
lista = em.createQuery(query).setParameter(1, u).getResultList();
} finally {
em.close();
}
return lista;
}
Aguardo ao retorno pela dica ou corrigir esse erros, obrigado!!