0 Replies Latest reply on Apr 16, 2007 12:43 PM by elsieq

    Named query not known error with Jboss/EJB3

    elsieq

      Hi,

      I am using jboss-4.0.5 GA. When I try to use a named query, I am getting a hibernate mapping exception "Named query not known". The steps to create and use a named query with EJB3 seem very simple so I don't know where I'm going wrong.

      I have defined the named query with the entity like this:

      @Entity
      @NamedQuery(name="findGroupsByMemberId",
      query="select gm from Groupmember gm where gm.memberIdKy = :memberId")
      @Table(name = "groupmember", catalog = "cmpe275db", uniqueConstraints = {})
      public class Groupmember implements java.io.Serializable {


      I then use that query in a stateless session bean like this:

      Query q = em.createNamedQuery("findGroupsByMemberId");
      q.setParameter("memberId",stumblerId);



      Since I am coding to EJB3 and also using Eclipse with the JBossIDE plugin, that is pretty much all I need to do. As far as I know, I don't have to deal with mapping files or anything else like that.

      Any clues or insights would be really appreciated.

      Regards,
      -Elsie Qureshi