Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with NativeQuery

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)
return query.getResultList();

But when I call this function I got this exception:

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) .....
Caused by: java.lang.NullPointerException
at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(
at org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(
at org.jboss.aop.Dispatcher.invoke(
at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(
at org.jboss.remoting.ServerInvoker.invoke(
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic