3 Replies Latest reply on Nov 19, 2001 8:24 PM by zx44093

    findall is not sorting

    Sundaram Ramasamy Newbie

      Hi,

      I want to sort the findAll result by userid and last_update field. I defined my jaws.xml file like this.


      findAll
      1=1
      userid, last_update
      <read-ahead>true</read-ahead>


      But this is not returning the sorted result.

      Any help on this???

      -SR

        • 1. Re: findall is not sorting
          Sundaram Ramasamy Newbie

          FYI,


          > There's a bug in versions from about 2.4 to 2.4.3 that causes this to
          > not work. The workaround is simply to call the finder something other
          > than findAll. Fix is in for version 2.4.4
          >

          So I have changed like this.


          findByUserid
          userid like {0}
          userid, last_update
          <read-ahead>true</read-ahead>


          from my client program I will call like this

          s.findByUserid( "%");

          it returns all records order by userid and last_update field.

          • 2. Re: findall is not sorting
            zx44093 Newbie

            I have a very strange problem with findAll. It always missing the last two elements in the collection. I convert it to an array like this:

            Cd[] = (Cd[])((cdHome.findAll()).toArray(new Cd[0]));

            If I reference the last two element in the array, I will get the following error:

            [CdBean] TRANSACTION ROLLBACK EXCEPTION:Load failed; nested exception is:

            java.lang.NullPointerException; nested exception is:
            java.rmi.ServerException: Load failed; nested exception is:
            java.lang.NullPointerException
            [CdBean] java.rmi.ServerException: Load failed; nested exception is:
            [CdBean] java.lang.NullPointerException
            [CdBean] java.lang.NullPointerException
            [CdBean] at java.lang.reflect.Field.set(Native Method)
            [CdBean] at org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.setCMPFie
            ldValue(JDBCCommand.java:655)
            [CdBean] at org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand
            .loadOneEntity(JDBCLoadEntityCommand.java:217)
            [CdBean] at
            .......

            • 3. Re: findall is not sorting
              zx44093 Newbie

              I finally found the problem. It was caused by some null value in the database.