0 Replies Latest reply on Dec 13, 2002 4:54 AM by Yevgen Bushuyev

    CMP findAll affects further behavior of SELECT... queries

    Yevgen Bushuyev Newbie



      Hi.
      I wonder why jboss constructs select queries in such a strange way.
      i have following functions in my SLSB where i retrieve some data from CMPs:

      /**
      * @ejb:interface-method view-type="remote"
      **/
      public void shit(){
      try {

      GoodLocal good = goodLocalHome.findById(2);

      Iterator i = good.getProps().iterator();



      } catch (Exception e){
      System.out.println("shit: "+e);

      }
      }

      /**
      * @ejb:interface-method view-type="remote"
      **/
      public void shit2(){
      try {
      goodLocalHome.findAll();

      GoodLocal good = goodLocalHome.findById(2);

      Iterator i = good.getProps().iterator();



      } catch (Exception e){
      System.out.println("shit: "+e);

      }
      }


      first results in
      021213 11:57:26 35 Query SET autocommit=0
      35 Query SELECT id FROM goods WHERE id=2
      35 Query SELECT name, des, pic FROM goods WHERE (id=2)
      35 Query SELECT prop_id FROM goods_props WHERE (good_id=2)
      35 Query commit


      and second in:

      35 Query SELECT id FROM goods
      35 Query SELECT id FROM goods WHERE id=2
      35 Query SELECT id,name, des, pic FROM goods WHERE (id=2) OR (id=3) OR (id=4) OR (id=5) OR (id=6) OR (id=7) OR (id=8) OR (id=9) OR (id=10) OR (id=11) OR (id=12) OR (id=13) OR (id=14) OR (id=15) OR (id=16) OR (id=17)
      35 Query SELECT good_id, prop_id FROM goods_props WHERE (good_id=2) OR (good_id=3) OR (good_id=4) OR (good_id=5) OR (good_id=6) OR (good_id=7) OR (good_id=8) OR (good_id=9) OR (good_id=10) OR (good_id=11) OR (good_id=12) OR (good_id=13) OR (good_id=14) OR (good_id=15) OR (good_id=16) OR (good_id=17)
      35 Query commit


      crowd of ()OR() appears in every further call to Good CMP. Only after reloading ejbs queries became "normal".
      And this leads to enormous load on sql server (mysql in my case) which in its turn slows down all my apps.

      Any suggestions?