2 Replies Latest reply on Mar 24, 2003 5:18 PM by marcwea

    commit option A, caching and ejbStore()

    marcwea

      Hello,

      I am a happy user of Jboss-3.0.4_tomcat with postgres. But I have a little question about caching. I created a counter bean and want jboss to cache it using the commit-option A. When I run jboss and the process, each time the counter is updated, jboss calls ejbStore() and updates the bean in the db. Which I want to avoid. Why does it happen, how does it work?

      The jboss.xml is as below, and the counter bean is a very simple CMP 2.x bean.

      Thanks for your help... I went throught the Jboss-3*** docs already but I am affraid I did not find any explaination.

      <?xml version="1.0" encoding="Cp1252"?>


      false
      <container-configurations>
      <container-configuration>
      <container-name>Standard CMP 2.x EntityBean</container-name>
      <commit-option>A</commit-option>
      </container-configuration>
      </container-configurations>


      <enterprise-beans>


      <ejb-name>CounterEJB</ejb-name>
      <jndi-name>Counter</jndi-name>


      </enterprise-beans>



      Marc

        • 1. Re: commit option A, caching and ejbStore()
          cepage

          If you do not want to store your counter in a back-end database, then you probably don't want to set up this counter as a CMP field.

          Commit-option A caching prevents unnecessary ejbLoad() calls from being performed when you access the field, but it does not disassociate the field from the database.

          Corby

          • 2. Re: commit option A, caching and ejbStore()
            marcwea

            Hi Corby,

            Thanks for your repply. The issue is also that I want to set the counter as a CMP field or at least I want it to be persisted in db when it stops until it resumes...

            So maybe I should persist into a field when the ejbStore()method is called? I will try that...
            Thanks again!

            Marc