Alguem sabe como posso fazer uma consulta com inner join entre 3 tabelas no hibernate? coisa do tipo: select pesquisa from Pesquisa pesquisa
INNER JOIN pesquisa.perguntasPesquisas perguntas
INNER JOIN pesquisa.perguntasPesquisas.respostasPesquisa respostas
where pesquisa.codiPesq = :codiPesq
order by perguntas.codiPerg
onde uma pesquisa tem varias perguntas e uma pergunta tem varias respostas? da forma como está acontece o seguinte erro:
net.sf.hibernate.QueryException: expecting 'elements' or 'indices' after: pesquisa.perguntasPesquisas.respostasPesquisa [ select pesquisa from com.simplestec.pesquisa.dados.beans.Pesquisa pesquisa, pesquisa.perguntasPesquisas perguntas, pesquisa.perguntasPesquisas.respostasPesquisa where pesquisa.codiPesq = :codiPesq ]
at net.sf.hibernate.hql.PathExpressionParser.doCollectionProperty(PathExpressionParser.java:469)
at net.sf.hibernate.hql.PathExpressionParser.token(PathExpressionParser.java:172)
Quando faco apenas entre pesquisa e pergunta da tudo certo, ela retorna um objeto pesquisa com todas as suas perguntas
obrigado.
