Reputation: 457
I have a project in Java EE. When I access the table from database it returns error, here's the HQL query :
select b from Blacklist b inner join fetch b.users u where b.type ilike :type order by b.date desc
and this the error message :
18:18:10,694 ERROR [STDERR] java.lang.NullPointerException
18:18:10,694 ERROR [STDERR] at org.hibernate.engine.query.QueryPlanCache$HQLQueryPlanKey.<init>(QueryPlanCache.java:193)
18:18:10,694 ERROR [STDERR] at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:87)
18:18:10,694 ERROR [STDERR] at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
18:18:10,694 ERROR [STDERR] at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
18:18:10,694 ERROR [STDERR] at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1650)
18:18:10,694 ERROR [STDERR] at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:93)
18:18:10,694 ERROR [STDERR] at org.jboss.jpa.tx.TransactionScopedEntityManager.createQuery(TransactionScopedEntityManager.java:139)
18:18:10,694 ERROR [STDERR] at doku.edp.trasactions.Eds2UtilityBean.getFieldDataFromBlacklist(Eds2UtilityBean.java:325)
18:18:10,694 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
18:18:10,695 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
18:18:10,695 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
18:18:10,695 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
18:18:10,695 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:122)
18:18:10,695 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111)
18:18:10,695 ERROR [STDERR] at org.jboss.ejb3.EJBContainerInvocationWrapper.invokeNext(EJBContainerInvocationWrapper.java:69)
18:18:10,695 ERROR [STDERR] at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.invoke(InterceptorSequencer.java:73)
18:18:10,695 ERROR [STDERR] at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.aroundInvoke(InterceptorSequencer.java:59)
18:18:10,695 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor522.invoke(Unknown Source)
18:18:10,695 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
18:18:10,695 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
18:18:10,695 ERROR [STDERR] at org.jboss.aop.advice.PerJoinpointAdvice.invoke(PerJoinpointAdvice.java:174)
18:18:10,695 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
18:18:10,695 ERROR [STDERR] at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.fillMethod(InvocationContextInterceptor.java:72)
18:18:10,695 ERROR [STDERR] at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_fillMethod_405857447.invoke(InvocationContextInterceptor_z_fillMethod_405857447.java)
18:18:10,695 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
18:18:10,695 ERROR [STDERR] at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.setup(InvocationContextInterceptor.java:88)
18:18:10,695 ERROR [STDERR] at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_setup_405857447.invoke(InvocationContextInterceptor_z_setup_405857447.java)
18:18:10,695 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
18:18:10,695 ERROR [STDERR] at org.jboss.ejb3.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:62)
I see my Postgres DB, when I'm doing SELECT
query to the table, then I get a warning:
permision denied for relation whitelist.
Does the warning on Postgres is the cause of this error?
Upvotes: 0
Views: 1493
Reputation: 30875
From the stack, we could say that something wrong is with the query that you have created.
To be sure i would add as
and remove the ilike
and the select
clause from it.
from Blacklist as b inner join fetch b.users as u where b.type like :type order by b.date desc
The ilike operator do exists in Expression, but i am not aware about HQL try to execute about query.
Upvotes: 0
Reputation: 220
Only assuming as you haven't posted any Java code but looks like your NullPointer which is probably a ResultSet which dosen't contain any results is because you don't have the right permissions to read/write onto the relation 'whitelist'. I'd check what username your using to login to the database against which username your using for the jdbc connection.
If you post your java code we can see if the NullPointer is because of an empty result set which you are then trying to manipulate or because of something else.
First question i've answered so sorry if its wordy.
Upvotes: 1