3 Replies Latest reply on Feb 20, 2002 5:26 AM by drcharris

    ejbStore after every get*****()

    thl-mot

      How can I stop the container to call ejbStore after I call a get method of the Entyty beam (Bean Managed persistence). In the book "Mastering Enterprise JavaBeans" Ed Roman writes that this can be handled by the transaction mode of the bean, but in that chapter he isnt't telling anything about this.

      I'd also appreciate a good and short description of the deployment descriptors (ejb-jar.xml and jboss.xml).

        • 1. Re: ejbStore after every get*****()
          davidjencks

          Transaction mode is not likely to help much. You can
          for cmp1.x
          - use tuned-updates, which keeps copies of all the field values and compares when ejbStore is called to see if a db write is necessary
          -implement an isModified method in which you say whether anything changed
          -in jboss 3, use the jboss.xml read-only tag, which prevents ejbStore from ever being called.
          -in jboss 3, use cmp2 which does the first two choices for you automatically.

          The container can't tell how much data is changing from the "getXXX" call- you could doa anything you wanted to spite the naming convention.

          • 2. Re: ejbStore after every get*****()
            thl-mot

            nice idea,
            but anyway, what is the sense of making then bean persistent after a read operation.

            To me it doesn't make any sense.

            • 3. Re: ejbStore after every get*****()
              drcharris

              There's no way of telling the container that a getXXX() method is read-only. It's just a naming convention. Therefore for correctness the container has to play safe and sync the bean to the database.

              I'll bet somewhere someone's got a method called getRidOfAttribute() !