0

I have a web-app communicating to an EJB service to retrieve data and show it to clients.

The DB for both web-app and EJB service are different. I cache whatever data I retrieve from the EJB service using ehcache in my web-app. Now, whenever the data that is being served by the EJB service changes at the DB( Oracle) level the cache in my web-app needs to get notified.

Is there anyway my cache can receive such notifications and refresh itself with new data?

Arun
  • 311
  • 3
  • 7
  • 15
  • Your problem is cache invalidation, see http://stackoverflow.com/questions/1188587/cache-invalidationis-there-a-general-solution – Qwerky Apr 05 '13 at 15:09
  • I'm not sure how is it with JDBC, but when using OCI you can use something like "Client side result cache". Then you can Oracle let notify you that the underlying table was changed. I think Oracle has something similar for WebLogic too. – ibre5041 Apr 05 '13 at 16:01
  • Check out change notification: http://docs.oracle.com/cd/E11882_01/java.112/e16548/dbchgnf.htm –  Apr 06 '13 at 22:22
  • DCN mentioned above is one thing that I am considering but I was just wondering can this be achieved using Jgroups? – Arun Apr 07 '13 at 06:37

1 Answers1

0

Make one listener that get notified whenever you receive any data from ejb, for this make use of observer design pattern or via jms. And in the listener you can reload the particular element inside the Ehcache.

sorabh solanki
  • 480
  • 1
  • 7
  • 18