1 Reply Latest reply on May 13, 2004 11:48 AM by konstantinidis

    EJB-QL query

    nacho2004

      somebody knows how I can do this query with EJB-QL

      Select A.catid FROM catparents A
      where
      (A.parentid IN (SELECT B.parentid from dbo.catparents B WHERE
      (B.catid = 4) AND (B.depth = 0))
      AND (A.depth = 0) AND (A.catid <> 4))

      thanks in advance

        • 1. Re: EJB-QL query
          konstantinidis

          Hi,

          subqueries are not supported in EJB-QL or JBossQL.
          You can use non-standard JBoss DeclaredSQL.

          In Bean Catparents you write

          @ejb.finder
          query = "" <-- needs to be empty
          signature = "Collection findByXXX()"

          @jboss.Declared-SQL
          alias = "A"
          where = "<your WHERE-clause>" (With Database-Fields instead of
          BeanFields)
          signature = "Collection findByXXX()"

          In this case you would get a collection containing all Catparents entities fitting your selection.

          look at http://xdoclet.sourceforge.net for further details on the tags. Also look at the JBoss Docs for some skin-deep info.