4 Replies Latest reply on Apr 25, 2003 6:24 AM by Roland Bergler

    sync-on-commit-only ?

    Roland Bergler Newbie

      In my application I call several business methods on a BMP entity
      within one transaction and I observed that after each business method
      ejbStore is invoked, although in my eyes this is not necessary. It
      would be enough to call it once immediately before the commit. The
      only problem I could possibly get is that queries (e.g. finder
      methods) from within the same transaction would see the database in
      the state it was before the transaction.

      In my application change of this behaviour this would reduce database
      traffic to a fraction, because I do several business method call
      on the same EJB within the same transaction.

      Can I use the undocumented (I use the documentation as of September
      30, 2002 8:04) feature <sync-on-commit-only>true<sync-on-commit-only>
      field in the container-configuration for this? Why is this feature in
      the container configuration but not overridable from jboss.xml??

      Greetings
      Roland

        • 1. Re: sync-on-commit-only ?
          Adrian Brock Master

          You can add a method

          boolean isModified();

          Which the container will invoke to find
          out whether a store is necessary.
          This is a jboss specific feature.

          Pretty much anything that can comes from standardjboss.xml
          can be overridden in jboss.xml
          They use the same parser code.

          Regards,
          Adrian

          • 2. Re: sync-on-commit-only ?
            Roland Bergler Newbie

            Thats not the same for me: The state at the beginning of a transaction is very similar to the state at the end, so there would be very little to store, but intermediate states can be completely different. So when ejbStore is invoked after every business method very much state changes will be stored unneccessarily.

            The sync-on-commit flag is missing from the jboss_3_0.dtd, so are you sure it can be overridden?

            • 3. Re: sync-on-commit-only ?
              Adrian Brock Master

              Yes,

              public void importJbossXml(Element element) throws DeploymentException
              {
              // everything is optional to allow jboss.xml to modify part of a configuration
              // defined in standardjboss.xml
              // set call logging
              callLogging = Boolean.valueOf(getElementContent(getOptionalChild(element, "call-logging"), String.valueOf(callLogging))).booleanValue();
              // set synchronize on commit only
              syncOnCommitOnly = Boolean.valueOf(getElementContent(getOptionalChild(element, "sync-on-commit-only"), String.valueOf(syncOnCommitOnly))).booleanValue();

              Raise a bug report for the dtd.

              Regards,
              Adrian

              • 4. Re: sync-on-commit-only ?
                Roland Bergler Newbie

                I dont understand what the code does, but it does NOT work when overridden from jboss.xml.

                I made some tests setting <sync-on-commit-only> from standardjboss.xml and jboss.xml and I can see an effect only if I set the flag in standardjboss.xml.

                I am quite shure that the configuration settings (other than sync-on-commit-onl>) in jboss.xml are correct.