1 Reply Latest reply on Apr 23, 2003 8:35 AM by adrian.brock

    Read Only Method Does Not Synch With Database

    tripperm

      Hi,

      I currently have an entity bean which has a method that returns a Model object of its contents. In the descriptor file for the cmp entity bean I declared the method that returns the model as read-only. I did this to cut down on deadlocks with high concurrency on the bean. This works well, but the only problem is that if there is a change to the underlying data store, the call to the read-only method does not synch the entity bean with the data store before returning the model. So I end up getting stale data back.

      This is quite confusing as I am running with commit option C, and if I remove the read-only attribute for the method, it is in synch with the data store (but it now can get into deadlock situations more easily).

      I'm running JBoss 3.0.2 with Tomcat 4.0.4. Any help would be appreciated.

      Thanks.

        • 1. Re: Read Only Method Does Not Synch With Database

          You declare it <read-only> because you know
          it won't change the data. This allows the container
          not to lock the bean.

          I would look at the cause of the deadlock,
          they are always ordering problems.

          If you upgrade to 3.0.5+ you get automatic
          deadlock retries for CMT. But it is still better
          to avoid deadlocks.

          Regards,
          Adrian