Sean Schofield wrote the following on 2/14/2005 11:23 AM:
With the application scope beans in JSF I have been toying with the idea of using them instead. I was thinking that it might be possible to invalidate the bean (by setting the value to null) whenever a new item is added. I haven't worked out the details yet but thread safety is an issue that jumps to mind. Also, you'd have to have make sure that you were listening to every possible point where the list might change.
That last part is the tricky part. It's super easy if you know the data will only be altered by your web application. If that is the case you can forget even using application scoped items and simply use iBATIS for your persistence framework (uses regular SQL). It has some great caching mechanisms to handle the issues you are concerned with. For example whenever an update operation is performed (by calling your defined update procedure in an xml doc) you could set a flag in the udpate procedure that will clear the cache of other queries. The bottom line, though, is this is all nice, but everywhere I have worked the data often changes from some other point other than your web app. This is where it gets very ugly. What are you going to do when some other external procedure updates your backend data? Accounting for those entry points can be a royal pain.
-- Rick