0 Replies Latest reply on May 12, 2005 12:50 PM by bhood1

    EJBQL ORDER BY with boolean

    bhood1 Newbie

      I'm trying to use a dynamic EJBQL/JbossQL expresssion that involves an ORDER BY of a boolean CMP attribute:

      SELECT OBJECT(o) FROM UserBean AS o ORDER BY o.active

      Where UserBean.active is a CMP2 boolean attribute (extract from UserBean.java, using XDoclet)

      * @ejb.persistent-field
      * @ejb.interface-method view-type="local"
      * @ejb.persistence column-name="B_ACTIVE"
      public abstract boolean getActive();
      /** @ejb.interface-method view-type="local" */
      public abstract void setActive(boolean value);

      I'm getting a FinderException when I execute the query:

      javax.ejb.FinderException: Error compiling ejbql: org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "o.active" at line 1, column 45.
      Was expecting one of:

      Are booleans supported in ORDER BY? Are there any good workarounds if they are not?

      I'm currently using jboss3.2.5 and Oracle10g, but I'm open to migrating to a newer version for this support.

      Thanks in advance.