7 Replies Latest reply on Jan 28, 2003 4:29 AM by Bouassida

    EJB-QL supported type in JBoss 3.0.4

    Bouassida Newbie

      Hi,

      I have an ejb-ql problem !

      Here is my request :


      <query-method>
      <method-name>
      findMessage
      </method-name>
      <method-params>
      <method-param>java.math.BigDecimal</method-param>
      <method-param>java.lang.String</method-param>
      </method-params>
      </query-method>
      <ejb-ql>
      SELECT OBJECT(o)
      FROM CurrentMessage AS o
      WHERE o.nombre = ?1 AND o.strId = ?3
      </ejb-ql>

      And I've got :

      Error compiling ejbql; - nested throwable: (org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "o.nombre" at line 3, column 41.
      Was expecting one of:
      "NOT" ...
      "(" ...
      <COLLECTION_VALUED_PATH> ...
      <STRING_VALUED_PATH> ...
      "CONCAT" ...
      "SUBSTRING" ...
      <BOOLEAN_VALUED_PATH> ...
      <DATETIME_VALUED_PATH> ...
      <ENTITY_VALUED_PATH> ...
      <IDENTIFICATION_VARIABLE> ...
      <NUMERIC_VALUED_PATH> ...
      "LENGTH" ...
      "LOCATE" ...
      "ABS" ...
      "SQRT" ...
      "+" ...
      "-" ...
      <INTEGER_LITERAL> ...
      <FLOATING_POINT_LITERAL> ...
      <NUMERIC_VALUED_PARAMETER> ...
      )


      When I only put :
      <ejb-ql>
      SELECT OBJECT(o)
      FROM CurrentMessage AS o
      WHERE o.strId = ?3
      </ejb-ql>

      That runs.
      I think that it comes from the decimal type that seems to not be supported by JBoss 3.0.4.

      I've read that some types are not supported. Can someone tell me whitch types are supported ?

      More over, I've read that there was also a JBoss-QL. Does anyone know something about it ?

      Thanks a lot for your help

      Nadia

        • 1. Re: EJB-QL supported type in JBoss 3.0.4
          Alexandru Popescu Newbie

          For the first problem:
          - i think that you just jumped over to the third argument that is not defined for that finder
          - try to put some paranthesis around the conditions

          For the second:
          <<JBossQL is a superset of EJB-QL that is designed to address some of the inadequacies of
          EJB-QL. In addition to a more flexible syntax, new functions, key words, and clauses have been
          added to JBossQL.>>

          For more on this i think you must subscribe to the documentation of JBoss.

          Note: i am not working at jboss.

          pope
          ---
          There are only solutions

          • 2. Re: EJB-QL supported type in JBoss 3.0.4
            Bouassida Newbie

            Hi Alexandru,

            >For the first problem:
            >- i think that you just jumped over to the third argument >that is not defined for that finder

            --> It's an error of me, the real code is :

            <method-params>
            <method-param>java.math.BigDecimal</method-param>
            <method-param>java.lang.String</method-param>
            </method-params>
            </query-method>
            <ejb-ql>
            SELECT OBJECT(o)
            FROM CurrentMessage AS o
            WHERE o.nombre = ?1 AND o.strId = ?2
            </ejb-ql>

            >- try to put some paranthesis around the conditions

            --> I've done it without but it still wrong.


            >For more on this i think you must subscribe to the documentation of JBoss.

            --> I agree with you but for the moment I can't. It doesn't depend on me ...


            But I really wonder if the BigDecimal type is supported by JBoss .... cause, if I put 2 string it runs, if I put an integer, it also runs ...

            Thanks for your help.

            Nadia

            • 3. Re: EJB-QL supported type in JBoss 3.0.4
              Noel Rocher Apprentice

              Hi Nadia,


              Which is your DB.

              With MSSQLSERVER2000 big decimal is translated as you can see in your jbosscmpjdbc.xml in the conf directory of your server.

              ====================================
              ...

              <java-type>java.math.BigDecimal</java-type>
              <jdbc-type>VARCHAR</jdbc-type>
              <sql-type>VARCHAR(256)</sql-type>


              ====================================

              Tell me if it helps

              Noel

              • 4. Re: EJB-QL supported type in JBoss 3.0.4
                Noel Rocher Apprentice

                Sorry Nadia,

                I've seen your previous message ...

                Noel

                • 5. Re: EJB-QL supported type in JBoss 3.0.4
                  Bouassida Newbie

                  Hi noel,

                  I'm using Oracle 9i.


                  >With MSSQLSERVER2000 big decimal is translated as you can see in your jbosscmpjdbc.xml in the conf directory of your server.

                  --> ahhhhhhhh !!!!!
                  I didn't know that file !!!!
                  So here is the part interesting for me in the standardjbosscmp-jdbc.xml :


                  <java-type>java.math.BigDecimal</java-type>
                  <jdbc-type>DECIMAL</jdbc-type>
                  <sql-type>NUMBER(38,15)</sql-type>


                  So Jboss accep it .... good !

                  My question is know : What should I do with that file ?
                  Should I copy it in my server\deploy directory ?
                  Should I change my ejb-ql request and write DECIMAL or NUMBER(38,15) ?

                  That the first time i use it so i don't really know how to do ...

                  Thanks for your help.

                  Nadia

                  • 6. Re: EJB-QL supported type in JBoss 3.0.4
                    Noel Rocher Apprentice

                    Nadia,

                    1) The files here describe the default behavior of JBoss.
                    Each one can be overload in your deployment descriptors (web & EJB).

                    2) as far as we talk about type mapping, you have to think that it's the way JBoss knows how to translate java type in your finders (or selects) to SQL depending on the DB you configure in your datasources. So you have to check if your database column type you use is compatible with the one JBoss will use (in your case NUMBER(38,15) ).



                    3) It's good to know that people from Atos Origin are interested in this kind of product and not only on big brands' ones.

                    Noel

                    • 7. Re: EJB-QL supported type in JBoss 3.0.4
                      Bouassida Newbie

                      Ok, thanks.

                      Nadia