Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-735

ejbSelectGeneric returns wrong results

    XMLWordPrintable

Details

    Description

      SourceForge Submitter: pkorros .
      I have a home method in my cmp entity bean

      public Page ejbHomeGetUsers(
      int offset,
      int limit)
      throws FinderException

      { long userCount = ((Long) ejbSelectGeneric("SELECT COUNT( o.id ) FROM User o ", new Object[0]) .iterator ().next()).longValue(); Collection users = ejbSelectGeneric( "SELECT OBJECT( o ) FROM User o OFFSET ?1 LIMIT ?2", new Object[] {new Integer(offset),new Integer(limit)}

      );

      return new Page(users, userCount, offset);
      }

      There is a bug in jboss 3.2.x (confirmed for Jboss
      3.2.2RC4 and 3.2.2Final) that causes the second call to
      ejbSelectGeneric to return a collection of o.id elements
      instead of User objects.

      When I changed the code that counts the elements to:
      long userCount = ((Long) ejbSelectGeneric("SELECT
      OBJECT( o ) FROM User o ", new Object[0]) .size();

      Everything worked ok.

      Attachments

        Activity

          People

            olubyans@redhat.com Alexey Loubyansky
            sourceforge-user SourceForge legacy user (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: