I got this app that all it does is perform selects and after I’m done reading that I no longer need the objects at all.
I got no problem reading the data, as the queries are very atomic. My problem is the big amount of data there, so eventually the old stored objects in heap lead to a out of memory exception.
How can I perform selects that get rid of the previous objects?
The object will be referenced by the NH session cache. To get rid of them, you could
Clearthe session after the query (which also removes other objects from the session)Evicteach of the objectsselect a, borselect new Dto(a, b)) which doesn’t use the cache at all.