1 Reply Latest reply on Sep 4, 2003 5:04 AM by mdt

    large query from findBy.... Help

    mang qin Newbie

      Hi, I am using jboss3.0.2

      I don't understand why this is happening. I have a findBy for an entitybean, it looks like the server does the findBy sql first, then when I try to iterate through the result set, it does this giant query select x,y from abc where (x=?) or (x=?) ......
      Why is that? So to get the first element, it does it giant query, then it goes though fine till the 255th element.
      After a while, another call to findBy and iteration again, no giant query created,
      after a few times, gian query appears again.

      Please help. This giant query is eating up my oracle user cpu.

        • 1. Re: large query from findBy.... Help
          mdt Newbie


          This is because the container pre-loads all of the ejbs before it lets you access them individually inside your iteration. This is done in one huge SELECT statement rather than N select statements for N number of beans to be loaded as in BMP. The reason this query only happens some of the time is due to the caching of the beans in memory.

          My issue is that this one huge SELECT statement containing all the 'OR (pk = ?) OR (pk = ?) OR (pk = ?)' kills my database with a large number of OR's. Does anyone know how to configure the container to do something other OR's???