2 Replies Latest reply on Jul 1, 2005 7:04 AM by Emmanuel Bernard

    Duplicate query named: findAll when using @NamedQuery on two

    Ronald Mathies Newbie

      Environment:
      Windows XP
      JBoss [TheOne] 5.0.0alpha (build: CVSTag=HEAD date=200505222202)
      Oracle 9

      I've olso tested on the following environment:

      Windows XP
      JBoss 4.02 final
      EJB 3 Preview 5
      Oracle 9

      I'm getting the following error message :

      --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
      ObjectName: jboss.j2ee:service=EJB3,module=ejb3.ejb3
      State: FAILED
      Reason: org.hibernate.MappingException: Duplicate query named: findAll

      On deploying two entity's withe the following named query's at class level:

      First Entity :

      @Entity
      @Table(name = "F_TALEN")
      @NamedQueries(
       {
       @NamedQuery(name="findAll", queryString="SELECT OBJECT(l) FROM Language l")
       }
       )
      public class Language extends EntityBase implements java.io.Serializable {
      ...
      }
      


      Second Entity:
      @Entity
      @Table(name = "F_VERSLAGGEVER")
      @NamedQueries(
       {
       @NamedQuery(name="findAll", queryString="SELECT OBJECT(r) FROM Reporter r")
       }
       )
      public class Reporter extends EntityBase implements java.io.Serializable {
      ...
      }
      


      The EJB3 Specification doesn't specify that it is not possible to have two named query's with the same name on different entity's.

      Is this a bug or is this something that is not possible to do?