EJB Caching issue

Discussions

EJB design: EJB Caching issue

  1. EJB Caching issue (3 messages)

    What happens to chaching when a application directly interacts with the database rather than going through EJBs.
    Looks like the chached data would be stale.
    If an application directly makes updates to the DB, is there any way that the container detects this and rereads the data from the DB to prevent stale data from being used.

    Ajay Amrite

    Threaded Messages (3)

  2. EJB Caching issue[ Go to top ]

    EJBLoad is the callback method which is called after "read-time-out-period" for Entity Beans. In EJBLoad you need to make sure for BMP's that the data your bean represent is not stale..

    Mayank
  3. EJB Caching issue[ Go to top ]

    hello Amrite,

    If the Application is directly interacting with the Database there is little that the Container can do. If you are using BMP and directly interacting with the DB, then you can use an extra column in your database table for a timestamp and then make sure that whenever you do an update to the Database that the timestamp that you have is the same as the timestamp value in the table. That is one of the ways in which you can avoid stale data causing problems in db updates. Actually this is a part of the Optimistic Locking strategy. I would refer you to an article titled 'CMP Performance problems explained' in the Home Section of this portal for further information on caching and stale data problems.

    Thanks

    -U
  4. EJB Caching issue[ Go to top ]

    Hello Uday

    I've also been considering how best to implement database synchronisation.

    The timestamp method may be best for my application, polling the database for changes is expensive and doesn't fully solve the problem.

    That article you recommended titled 'CMP Performance problems explained' sounds very useful but is no longer on the home page or in resources, have I missed it or is it gone?

    Regards

    Stuart.