1 Reply Latest reply on Oct 7, 2005 12:57 PM by Emmanuel Bernard

    General question where to put NamedQuerys ?

    Martin Heinemann Newbie

      Hi,

      i have an gerneal question. I'm going to put some NamedQueries into my EJB Project.
      The descibed way of how to call a NamedQuery is

       @PersistenceContext
       public EntityManager em;
       ...
       customers = em.createNamedQuery("findAllCustomersWithName")
       .setParameter("custName", "Smith")
       .getResultList();
      


      So, from what,, where or whatever does the container know which query from which bean should becalled?
      Is it an convention to make them unique in the whole application?
      I put them on top of my Bean-classes.
      When the queries are application-wide, is there a way to declare them in one file for all?


      Thanks for your answers


      martin