1 Reply Latest reply on Dec 19, 2002 8:01 PM by Jeremy Boynes

    ejbStore() question.

    Tim Newbie

      After reading many forum threads, news listings and jboss source
      I am left still asking the one question:


      Q: In CMP 2.0 with JBoss 3.0.4 how can I tell in the ejbStore() method
      if any fields are dirty.

      Why do I want to do this?

      I need this to test if a field should be written or not based on a dirty
      status.

      If ejbStore is going to be called all the time then there must be
      a way of telling if fields are dirty so the call back method is at least
      of some use. For example what If I wanted to write a xml file every time
      the record WAS dirty. As the code currently stands without any way of testing
      its a performance hit.

      The JDBCFieldBridge doohicky ( jboss source ) does exactly this.

      Why is this not done before ejbStore() is called?

        • 1. Re: ejbStore() question.
          Jeremy Boynes Newbie

          See the spec 10.5.2

          The container calls ejbStore as an indication that it is about to sync the bean to the database, not as indicator that it has done so. This allows the bean to prepare itself for sync e.g. by calling set accessor methods.

          It's entirely possible that the bean state is clean before ejbStore is called and dirty afterward.