1 Reply Latest reply on Nov 2, 2003 12:04 PM by Juha Lindfors

    bulk transfer of data in EJB

    kristiane Newbie

      Hi!

      I need to implement bulk transfer of data in EJBs, where data from one query are transfered in a number of
      sequencial RMI calls.

      Some words on my system architecture. I have a JBoss application server, connected to an Oracle database,
      through JDBC. A number of Java clients are communicating through RMI with the JBoss server. The business logic
      on the JBoss server are implemented with EJBs.

      I need to implement a feature on my system. The client need to fetch data, resulting from some SQL select,
      in bulks. First the 100 first rows, then the 100 next rows, and so on...

      How do I implement this in the server, using EJBs?

      I have one solution, that is not very elegant nor efficient:
      Using Stateful EJBs, make the initial query and keep the connection and ResultSet open. The ResultSet will
      behave like a cursor into the results (from the query), and for each new bulk of data to transfer, fetch more
      data from the ResultSet...
      This solution has a number of problems; Using a lot of connections (by keeping them up), Can't be passivated,
      Connection needs to be closed, when finished, etc...

      Anyone have a better, more elegant solution?
      Any clues or hints will be appreciated,

      ThanX,
      - Kristian

        • 1. Re: bulk transfer of data in EJB
          Juha Lindfors Master

          See the on-load optimizations in the CMP 2.0 engine documentation. This allows you to bulk load entity instances into the app server memory. It mimicks the cursor behavior on your database. As you populate your value collection to transfer to the client (triggering ejbLoads) it will load the next n rows from the database into memory.

          -- Juha