From: Gavin_King/Cirrus%<CI...@ci...> - 2002-08-06 01:59:13
|
>I would expect the following to happen: <snip> yep, thats right. The problem is that Hibernate models a collection as a seperate object from the entities contained in the collection. Thats why we (inefficiently) require two selects to materialize an association 1. To load the collection with ids + indices 2. To select all the referenced entities At some stage we need to rework this because of the inefficiency involved. But remember that not all Hibernate collections contain entities so this is a bit more work than it sounds (collections of values are retrieved in exactly one select). So essentially the collection cache (on CollectionPersister) caches the results of part 1. The entity cache (on ClassPersister) caches the results of part 2. (Just in case its been non-obvious from previous discussions, each entity class has its own ClassPersister + hence its own cache. Likewise each collection role has its own CollectionPersister + cache.) Anyway, I had spent so much time talking + thinking about all this that I knew exactly what to do to implement this (the collection cache) and so I just went ahead and did it last night. It only took me a couple of hours but would have taken someone else much longer. I've just got the configuration side left to worry about.... Gavin. |