1 Reply Latest reply on Jan 25, 2007 9:30 AM by Dalibor Kalna

    javax.resource.ResourceException: Transaction is not active

    Bää Thur Newbie

      Hi Im getting

      javax.resource.ResourceException: Transaction is not active


      when this code executes. (em = EntityManager)

      public getUserGoupById(Long id) {
       Query dbQuery = em.createQuery("from UserGroup where id = :id");
       dbQuery.setParameter("id", id);
       UserGroup ug = (UserGroup) dbQuery.getSingleResult();
       return ug //Here the exception will be thrown.
      }
      


      In debugmode Im able to see that ug is what Im looking for (right Id & name). But every time I trie to return it the exception will show. I use the same bean for getUserById(Long id), and it works fine. What could be wrong in the usergroup-case?

      Thanks!