0 Replies Latest reply on Nov 30, 2002 5:55 AM by Chris May

    Invalidating read-only entities

    Chris May Newbie

      Hi all,

      I have an application where Jboss is used to access a DB in an entirely read-only way. For performance reasons, we'd like the entity beans not to go back to the database once they're loaded. However, other applications can update the database from time to time, so we need a way of telling individual beans to reload themselves when their underlying data changes. The entities need to be up-to-date, so commit option D won't work for us.
      I've had a read through the CMP docs and I think I have a solution, but it seems rather over-complex so I wondered whether anyone else had a better one.

      Basically the approach I'm considering is to mark the entities as commit option B, have all the getter methods be transaction tpe NotSupported, and have a single "reload()" method that does nothing, but is transaction type "required". That way "gets" for the data will not invoke a transaction, so won't re-load from the database, but calling reload() will force a refresh, because it's inside a transaction.

      That seems a little clunky though. Is there a better way to do this ?

      TIA,

      Chris