1
Personal talk,
I have a problem trying to run an HQL on my application.
The HQL is basically this:
select c.id, c.solicitante from <mypackage>.Exame c
LEFT OUTER JOIN <mypackage>.Profissional prof
Java code:
hql = "select c.id, c.solicitante from <mypackage>.Exame c LEFT OUTER JOIN <mypackage>.Profissional prof";
session = HibernateUtil.currentSession();
Query query = session.createQuery(hql);//o erro acontece aqui
and Exception is as follows:
Caused by: java.lang.NullPointerException
at <mypackage>.DaoBase.executarQuery(DaoBase.java:129)
at <mypackage>.RelatoriosBean.gerarRelatorio(RelatoriosBean.java:73)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at javax.el.BeanELResolver.invokeMethod(BeanELResolver.java:779)
at javax.el.BeanELResolver.invoke(BeanELResolver.java:528)
at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:257)
at com.sun.el.parser.AstValue.invoke(AstValue.java:248)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:302)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:148)
I’m not an expert on HQL but I know there’s no need to spell out a clause WITH after the JOIN.
I don’t really know what it can be. It happens with any relationship I have in my class. As it is a reporting tool, if I select only primitive type fields (e.g.: String, Integer, etc.) HQL runs normally.
And yes, I did a lot of research on how to develop the HQL, I also looked to see if anyone has ever come across this problem but so far no proposed solution has helped me...
From now on I appreciate any help!
Ha, it took me a while to find this in the original hql hehe. By the way, I don’t think this is necessary
<mypackage>
ai also not huh? If the entity is mapped, I believe it will deboa. At least I never used.– Gustavo Cinque
@Gustavocinque really was not necessary. Sorry for the delay in answering, things were quite heavy at the time hahahah
– Vitor Alves Rocha
kkk Nevermind. I know what it’s like.
– Gustavo Cinque