4 Replies Latest reply on Sep 9, 2002 5:07 PM by Dain Sundstrom

    working with large result sets with CMP

    Vivek Chaudhri Newbie

      Hello:
      I am using jboss 3.0.0 with oracle 8.1.7. I am using CMP to persist my objects in the database.

      I have to provide functionality where I can page through a large collection of objects, specifically provide functionality to do previous/next like operations on my result set. I dont know how this would be done with CMP. My collection could be a large as several hundred thousand objects.

      Thanks
      Vivek

        • 1. Re: working with large result sets with CMP
          Dain Sundstrom Master

          It really depends. All JBoss really needs in the collection is the primary key of the object and all the other datadta can be loaded on demand. You will have to try the code and see how it works for you.

          • 2. Re: working with large result sets with CMP
            Vivek Chaudhri Newbie

            Thanks for the response. I dont see any why to do operations like previous. I know I can do things like next. How do I support scrolling like operations with CMP. Will I have to bypass CMP and use straight JDBC for operations that return large result sets.

            Thanks for all your help.
            Vivek

            • 3. Re: working with large result sets with CMP
              Jochen Cordes Novice

              Hi Vivek!

              I think your problem could be solved by implementing the ValueListHandler-Pattern (see J2EE patterns catalog provided by Sun). Essentially this means caching your data either on the server-side or client-side. If you prefer server-side (thus avoiding unnecessary network-traffic), consider using a stateful session-bean, which returns a collection and iterator providing the funcionality that suits your needs.

              Hope it helps,

              Jochen.

              P.S.: I'll have to implement this feature soon, especially for search-results. So don't hesitate to contact me.

              • 4. Re: working with large result sets with CMP
                Dain Sundstrom Master

                > Thanks for the response. I dont see any why to do
                > operations like previous. I know I can do things like
                > next. How do I support scrolling like operations with
                > CMP. Will I have to bypass CMP and use straight JDBC
                > for operations that return large result sets.

                You just get a collection by searching for the rows with a finder, ejbSelect or relationship collection (set read-ahead to none). Then you have a collection you can copy into an ArrayList and iterate over (forwards and backwards).