0 Replies Latest reply on Sep 26, 2009 8:09 PM by Chris Simons

    NPE on EM queries with no results; why?

    Chris Simons Expert

      Hi All,

      I'm experiencing an issue running our Seam application; the issue deals with entityManager.createQuery wherein no results are returned.


      result = (User)entityManager
                          "select poc.user from PointOfContact poc " +
                                  "where poc.organization.id=:oid and poc.primary=true")
                  .setParameter("oid", organization.getId())

      Under JBoss AS and Hibernate/JPA, this query would return no results but this would be handled gracefully.

      Now, under WebLogic (but ignore this fact, really, because it could happen under GlassFish or other JEE AS), I get a NullPointerException, such as:

      ]] Root cause of ServletException.
      javax.ejb.EJBException: EJB Exception: : java.lang.NullPointerException
              at com.bah.englink.ejb.pm.SkillExperienceManager.lookupExperienceLevels(SkillExperienceManager.java:244)

      If I catch the NPE, the application resumes normally.  But why the difference?  Since the returned value of this query is displayed using JSF EL, could that be the culprit?