This is clearly a real problem. When adding the notion of fetch groups it looks like I only adjusted the reading of values (SELECT) for fetch-groups. Updates should only consider initialized attributes - I had assumed that was already the case, clearly it is not. The same potential exists for property-based optimistic locking as well. We should verify that works with enhanced fetch groups as well. As far as how to account for fetch groups in regards to updates, here is a relevant discussion from HipChat:
Basically there is a potentially huge explosion here in regards to the SQL update Strings we will need to keep now for enhanced entities with more than one fetch group. We want to make sure we balance caching those Strings (save computational resources, add potentially large memory overhead) versus recreating them each time they are needed. Functionally a LRU style cache probably makes the most sense. I do worry a bit about the overhead of a LRU cache in regards to keeping the "recent access", which is why I suggested a FIFO cache. Another option would be to treat all enhanced entities via dynamic-update, making sure that dynamic-update properly accounts for non-initialized lazy via enhancement attributes. |