Gail Badner you asked me to comment on your "short-term proposal". Assuming this is that proposal:
One idea is to wrap the immutable ManagedEntity objects with a ManagedEntityHolder that implements ManagedEntity, adding ManagedEntityHolder#getManagedEntity to retrieve the actual immutable ManagedEntity (with null previous/next references). Instead, ManagedEntityHolder would hold the previous/next references specific to that PersistenceContext.
Sure that would work. But realize its essentially the same as what we used to do. In effect it is reverting much of the performance gain. Previously we would create a new EntityEntry for each immutable-entity + Session combo. It is this object creation that the performance work targeted. Unless I miss something, your proposal is to now create a new ManagedEntityHolder instance for each immutable-entity + Session combo. Will it "work"? Sure, it will address the bugs. But from a performance perspective you will wipe out all that work. |