4 Replies Latest reply on May 7, 2004 10:10 AM by fwesterop1

    ejbSelect with MAX()

    schlumpf

      Hello,

      I have a lot of trouble with ejbSelect-methods.
      The ejbSelect-methode should return the MAX-Value of an Integer-field:
      <jboss-ql>
      <![CDATA[SELECT MAX(k.kundenNummer) FROM Kunde AS k]]>
      </jboss-ql>
      The deployment is OK, but then it methode returns a Double-Value. The return type is Integer and also the field in the Database.
      What ist wrong?

        • 1. Re: ejbSelect with MAX()
          fwesterop1

          Hi,

          For me my ejbSelect behaves as expected as far as parameter / return types are concerned. I generate my ejbSelect with XDoclet (using the Lomboz plugin for the Eclipse IDE to be exact). See the topic below for my XDoclet code. Maybe it is of use to you, although I don't think you can make complicated mistakes there; it'pretty straightforward.

          http://www.jboss.org/index.html?module=bb&op=viewtopic&t=47782


          However I can't get JBoss to compile my EJB-QL query correctly wich contains the MAX() function. Would you mind sharing how you did that? I hope you're using XDoclet too, or are you coding the deployment xml files files etc. by hand?

          • 2. Re: ejbSelect with MAX()
            aloubyansky

            In 3.2.3 Max, as well as some other numeric functions, does return double always.
            3.2.4 supports EJBQL2.1 and respects the return type of ejbSelect.

            • 3. Re: ejbSelect with MAX()
              timkk

              It's nice to know, that JBoss returns always double.
              I have searched it in the documentation but I haven't found something.

              I don't use xdoclet, so i can't help you, sorry. I have written the part of the descriptor by hand, because i have made a migration from weblogic to jboss.

              But I will learn xdoclet, can you give me a tip, how i can do this best or where i can find good examples or tutorials?

              caio

              • 4. Re: ejbSelect with MAX()
                fwesterop1

                Hi timkk,

                Please have a look on my reply here:

                http://www.jboss.org/index.html?module=bb&op=viewtopic&t=47782

                Cheers,
                Frank