Hello! I'm looking for a way to keep my VO cache consistent with my beans. I don't want to invalidate my entire cache when I apply changes to one bean.
XDoclet generates my Value Objects, having relations to other Value Objects. I'm using lots of bi-directional aggregate relationships, so I need to use a lookup table to avoid loops (e.g. a.getB().getA().getB().getA()...). I'm using the (key,VO) tuple table as used in www-106.ibm.com/developerworks/library/j-santa1. This implementation works by checking whether a VO is already read into the tuple table. If so, the VO is read from the table and returned. Otherwise, the VO is inserted into the table and then returned. The result is a HashMap with lots of (key,VO) entries, representing the entire VO graph. The HashMap is populated entirely upon the first read of any object, since every relation is traversed in the VO. However, problems arise when I add/alter/delete my beans, since I somehow have to export this alteration to the cache. Does anyone have a working pattern for this? In particular I'm wondering whether to go for a cache-removal strategy, or whether to use a cache-update strategy. Keep in mind, the VO relations point to other VO's (not to a HashMap entry), which means I can't just remove every affected VO's from the cache when I remove bean A. Illustration follows: Example bean structure: (A) --N-------1-- (B) --N------1-- (C) If I remove A from the container I don't think I can just remove A from the cache, since the b.getAs() VO collection still has the A VO pointer (which I believe would be null after deletion of A). Furthermore, I don't think I can remove all of the A VO related VO's from the cache (to be re-read) since this creates the very same problem with C (null pointers) and so on. Hence, the only solution I see is updating the cached VO's just as I'm updating the bean. I have dirty flags and added/updated/removed queues available in my VO's for every relationship. However, before I implement any cache element update solution I want to check with you if better and less tedious solutions are available. Best regards, Ulf Sahlin ulf at s2 dot se ------------------------------------------------------- This SF.Net email is sponsored by OSTG. Have you noticed the changes on Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, one more big change to announce. We are now OSTG- Open Source Technology Group. Come see the changes on the new OSTG site. www.ostg.com _______________________________________________ xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user
