Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with NativeQuery  RSS feed

 
Laura Barroso
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have a problem with the function NativeQuery of the entityManager, here is my code:

public List executeNativeQuery(String aQuery, Class itemClass,int max) {

Query query = entityManager.createNativeQuery(aQuery, itemClass);
if (max > 0)
query.setMaxResults(max);
return query.getResultList();
}

But when I call this function I got this exception:

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) .....
Caused by: java.lang.NullPointerException
at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:379)
at org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(InvokableContextClassProxyHack.java:53)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:91)
at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:891)
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!