I seem to remember this topic came when we were working on the
Basically, EnhancementAsProxyLazinessInterceptor#session does not get
nullified when the PersistenceContext gets cleared.
As a result, such an entity can still get initialized if
the SharedSessionContractImplementor is still open.
I also noticed that narrowed proxies are never added to the
PersistenceContext, but they still have a reference to
the SharedSessionContractImplementor from which the narrowed proxy
originated. These references never get nullified either.
I believe these are both bugs, and I would like to address them.
Please let me know if I'm missing something here.