3 Replies Latest reply on Sep 16, 2003 9:10 AM by wolfc

    JBoss NOT EJB 2.0 Compliant ??!!!

    dandesch

      Okay, first of all, sorry for that subject line. I have a question that no one has replied to for several days. So I looked around and noticed that the questions that do get answered seem to have subject lines with two common characteristics: 1. provocative language, and 2. one or more exclamation points.

      I do not actually think that JBoss isn't compliant, but I am seeing error messages on startup that make it appear as if it weren't compliant

      Details:

      -> JBoss version 3.2.1.
      -> Attempting an EJBQL query that selects records from a Microsoft SQL Server database based on a range of value in one particular field using a WHERE clause.
      -> All entity beans implemented 100% CMP and CMR.

      On startup of JBoss, I get this message:
      org.jboss.deployment.DeploymentException: Error compiling EJB-QL statement 'SELECT object (a) FROM Account a WHERE a.accountNumber > ?1 AND a.accountNumber < ?2
      AND a.company.companyId = ?3'; - nested throwable: (org.jboss.ejb.plugins.cmp.e
      jbql.ParseException: Encountered ">" at line 1, column 56.
      Was expecting one of:
      "=" ...
      "<>" ...
      )

      So, it looks like JBoss is expecting only equal ("=") or not-equal ("<>") relationships, no greater than or less than allowed. I know that can't be right. The JBossCMP.pdf document I purchased from this very web site shows examples of EJBQL using the WHERE clause with the greater than symbol ("WHERE badness > ?1" or something like that). So, there must be something wrong with a config file somewhere or an obsolete jar file or something, but I have no idea where to look.

      Also, I had a colleague who works in a different office, and who runs a different version of JBoss (3.2.0) try this same query using the same beans and interfaces and ejb-jar.xml, and he gets the exact same error message.

      Anybody out there succesfully using the greater than and less than symbols in a WHERE clause in EJBQL? Did you have to do some sort of chicken swinging to get it to work? Do I have to buy some other document to instruct me on the eternal mysteries and show me the secret handshake? I'll gladly do that if that's what it takes, but I have no idea where to look.

        • 1. Re: JBoss NOT EJB 2.0 Compliant ??!!!
          wolfc

          EJB 2.0 spec 11.4 (EJB QL BNF) states that the operators you're using are only available for numeric values.

          Most likely accountNumber is not numeric.

          So slaughter a chicken, shake it's claw, change your code, redeploy and it'll probably work. :-)

          • 2. Re: JBoss NOT EJB 2.0 Compliant ??!!!
            dandesch

            > EJB 2.0 spec 11.4 (EJB QL BNF) states that the
            > operators you're using are only available for numeric
            > values.
            >
            > Most likely accountNumber is not numeric.
            >
            > So slaughter a chicken, shake it's claw, change your
            > code, redeploy and it'll probably work. :-)

            You are correct. AccountNumber is a String--thanks for your insight. Now, how to pass on this news to my colleagues: "Guys, I have good news and bad news. Good news is, I got a useful and coherent answer to my question on the JBoss forum. Bad news is, you're not going to like the answer."

            Some follow up questions:

            anybody have any idea why this restriction (greater than / less than comparisons valid only for numeric value) exists?

            Is there any chance this restriction will be loosened in a future version of EJB?

            I realize these are EJB spec questions rather than, strictly speaking, JBoss questions, but there you go.

            And to finish, a legitimate JBoss question: does the JBoss custom query language (is it called JBossQL?) allow for greater than / less than comparisons of String values?

            Thanks again wolfc for your response.


            • 3. Re: JBoss NOT EJB 2.0 Compliant ??!!!
              wolfc

              I don't know about the restrictions in the EJB spec, but you can find the jBossQL implementation for 3.2.1 here: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/ejbql/JBossQLParser.jjt?rev=1.6.2.3&content-type=text/vnd.viewcvs-markup

              At fist glance it appears to support more comparison operators on Strings and it looks like it can do an order by... hmm...