1 Reply Latest reply on Jan 31, 2003 7:30 AM by Stefan Jurk

    Useless sql statement executed using CMR

    Stefan Jurk Newbie

      Hi,
      We are using CMR with JBoss 3.02. This works quite fine, but the Container is generating a sql statement we really don't know
      why this is done. The problem is,that this single sql statement is very time consuming and completly useless!!
      It occurs before every insert or update on a cmr field of a entitybean using cmp with cmr.
      Does someone have any idea what the hell is going on here?
      Is there a way to get rid of this "feature"? Why is this sql statement generated?

      e.g.: There are twe entity beans TermLogBean and TermLanguageBean with a N:1 relationship.
      We are doing the following in a SessionBean:

      TermLogLocale termLogLocale;
      TermLanguageLocale termLanguageLocale;
      ...
      termLogLocale.setTermLanguage(termLanguageLocale); //set the cmr field termlanguage
      ...


      JBoss CMP generates this statement (We traced the logging messages with Chainsaw):
      in org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadRelationCommand.TermLanguage
      Executing SQL: SELECT TERM_LOG_ID FROM TERM_LOG WHERE (TERM_LOG_LANGUAGE_CODE=?)

      To execute this statement takes about 2 seconds !!
      This is done - as I mentioned above - before every insert or update. Imagine 1000 inserts.....

      Is this a normal behavior?

      Stefan

        • 1. Re: Useless sql statement executed using CMR
          Stefan Jurk Newbie

          I contacted Dain Sundstrom. Here is his answer:

          Try 3.0.6. A long while back I patched the CMR code to only generate
          only SQL statements that are absolutely necessary. If you are still
          getting junk statements after that, send me another email. BTW, I
          don't read the forums very often as the interface is sooooo slow. I
          suggest you use the jboss-user mailing list.

          -dain