3 Replies Latest reply on Mar 9, 2005 10:28 PM by kabirkhan

    NamedQuery

    schoetz

      Is there already support for named queries?

      If there is so, how do I use them? So far I can't get it working. I always get an "org.hibernate.MappingException: Named query not known: userByName" even if the NamedQuery is defined in an @NamedQuery Annotation at the method I try to access it.

      Just a note to Specification compatibility. The @NamedQuery Annotation in preview 4 has not all required attributes and one has a wrong name (ejbql instead of queryString

      schoetz

        • 1. Re: NamedQuery
          bill.burke

          Sorry, I don't support them yet. I'm not sure they are very useful so I've been putting off implementing them. THoughts?

          • 2. Re: NamedQuery
            robdaemon

             

            "bill.burke@jboss.com" wrote:
            Sorry, I don't support them yet. I'm not sure they are very useful so I've been putting off implementing them. THoughts?


            I was using them quite extensively in Hibernate2 but I've since started converting code to use Hibernate3 and annotations. I ended up reverting to declaring the queries in "public static final String"s instead.

            One of the reasons I prefer named queries is if I need to update a query quickly, it was defined at the top of my data POJO in an XDoclet annotation, and I put all the queries that involved that bean there. I felt more organized that way :)

            • 3. Re: NamedQuery
              kabirkhan

              OK, these are implemented in cvs now. See this for more comments:

              http://jira.jboss.com/jira/browse/EJBTHREE-99