6 Replies Latest reply on Jan 28, 2003 4:13 AM by nadia

    problem with BigDecimal

    nadia

      Hello,

      does anyone know if JBoss accept the BigDecimal type in ejb-ql request ?

      Thanks a lot

      Nadia

        • 1. Re: problem with BigDecimal
          pope

          You write an ejb-ql statement. Oke. But what's the relation of ejb-ql with the BigDecimal ??? It's a parameter inside the ejb-ql statement ? If so you must check in the mapping configuration file (i.e. "standardjbosscmp-jdbc.xml") that the BigDecimal java object is correctly mapped to the SQL specific type of your DB.

          pope
          ---
          There are only solutions !

          • 2. Re: problem with BigDecimal
            nadia

            Re hello Alexandru,

            So I've got, in my ejb-jar.xml that :


            <query-method>
            <method-name>findCurrentForFaultMessage</method-name>
            <method-params>
            <method-param>java.math.BigDecimal</method-param>
            <method-param>java.math.BigDecimal</method-param>
            <method-param>java.lang.String</method-param>
            </method-params>
            </query-method>
            <ejb-ql>
            SELECT OBJECT(o)
            FROM CurrentTopoFailureMessage AS o
            WHERE o.nbr1= ?1 AND o.nbr2 = ?2 AND o.strId = ?3
            </ejb-ql>


            That give an error, but if I remove that 2 parameters, that remove my error.

            I've already chek the mapping with my jbosscmp-jdbc.xml file and it's OK ...

            So .... does JBoss has a problem with the BigDecimal type ?

            Thanks

            Nadia

            • 3. Re: problem with BigDecimal
              tommyg

              BigDecimal is not supported in EJB-QL, but is supported in JBoss's extended JBoss-QL. You basically write the query as you have it in your ejb-jar file and then write the JBoss query in your jbosscmp-jdbc.xml file.

              I use Xdoclet to quickly see how these deployment files are written.

              • 4. Re: problem with BigDecimal
                nadia

                Hi tommyg ,

                Are you sure that " BigDecimal is not supported in EJB-QL" ?
                Do you know where I can find all the types supported by EJB-QL ?

                Then, if I use JBoss-QL, is the query the same than in my ejb-jar.xml ?

                Thanks,

                Nadia


                • 5. Re: problem with BigDecimal
                  tommyg

                  That's my understanding. The following code works.
                  It describes
                  1. part of my jbosscmp-jdbc.xml file
                  2. part of my ejb-jar.xml file.
                  3. Code in a session bean that uses the finder statement.

                  My guess is that JBoss overrides the standard query.


                  part of my jbosscmp-jdbc.xml file follows:


                  <query-method>
                  <method-name>findByPersonId</method-name>
                  <method-params>
                  <method-param>java.math.BigDecimal</method-param>
                  </method-params>
                  </query-method>
                  <jboss-ql><![CDATA[SELECT DISTINCT OBJECT(p) FROM PersonResource p WHERE p.personId = ?1]]></jboss-ql>






                  part of my ejb-jar.xml file follows here:

                  <query-method>
                  <method-name>findByPersonId</method-name>
                  <method-params>
                  <method-param>java.math.BigDecimal</method-param>
                  </method-params>
                  </query-method>
                  <ejb-ql><![CDATA[SELECT DISTINCT OBJECT(p) FROM PersonResource p WHERE p.personId = ?1]]></ejb-ql>


                  The code in the session bean that gets the collection follows:

                  Collection c = home.findByPersonId(bd);


                  • 6. Re: problem with BigDecimal
                    nadia

                    OK !

                    Thanks.
                    Nadia