2 Replies Latest reply on Sep 4, 2007 6:34 AM by barondodd

    EJBQL in JBoss 4 / EJB3 ?

      Just a quick question: When defining @NamedQueries for jboss ejb3 entities, can I use old EJB-QL from our EJB2 Entity Beans

      e.g
      @NamedQuery(name="findAllApplications", query="SELECT OBJECT(application) FROM Application application")

      Seem to be getting a lot of sytax errors reported:

      No data type for node: org.hibernate.hql.ast.tree.IdentNode \-[ALIAS_REF] IdentNode: 'application' {alias=application, no from element}

      It looks like it is expecting a HQL statement, however tons of the EJB3 tutorials online show NamedQueries containing the old EJB 2 finder syntax.

        • 1. Re: EJBQL in JBoss 4 / EJB3 ?

          .

          • 2. Re: EJBQL in JBoss 4 / EJB3 ?

            The problem is now solved, it seems to be that hibernates parser does not support all that EJB-QL did previously. Most of the problems centered around using the AS keyword within a join:

            SELECT DISTINCT OBJECT( p ) FROM Principal AS p, IN (p.roles) role AS r WHERE ......

            This worked in EJB 2.1 finder methods but does not deploy with EJB3 hibernate, should be:

            SELECT DISTINCT OBJECT( p ) FROM Principal AS p, IN (p.roles) role r WHERE ......