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

    General question where to put NamedQuerys ?

    heinrich

      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