JBoss Community

Re: Random NameNotFoundException in jboss 6.1-SNAPSHOT

created by jaikiran pai in EJB3 - View the full discussion

legae wrote:

 

...
I added queue depends and somehow now the findAll method can be invoked and no excpetion is thrown. I'm not 100% sure whether it's the right solution but for me it worked

 

@javax.ejb.Stateless
public class ZBean  implements ZBeanLocal{

    @PersistenceContext(unitName = "TestPU")
    private EntityManager em = null;

    @Resource(mappedName = "java:/JmsXA")
    javax.jms.ConnectionFactory connFactory;
    @Resource(mappedName = "queue/TestQueue")

    @org.jboss.ejb3.annotation.Depends("org.hornetq:module=JMS,type=Queue,name=\"TestQueue\"")
    javax.jms.Queue  q1;


    public List<ZEntity> findAll(){       
        Query q = em.createNamedQuery("findAll");
        return (List<ZEntity>)q.getResultList();
    }
}

That's the correct solution.

Reply to this message by going to Community

Start a new discussion in EJB3 at Community