Keep in mind that the Hibernate API (either Session or EntityManager) guarantees to return the same instance for an entity if it's being loaded multiple times: are you using projections?
Actually the existing ScrollableResultsImpl code takes care of that via soft reference and session.contains calls which makes me wonder why Markus Heberling's initial PR really solves the OOME, it means our LoadedObject shell is talking too much space. that's strange.
|