I was wondering if there is a way to tell Hibernate to generate some kind of console warning when there are too many objects of a certain type in the session cache. I would like to do this for load testing, since we have problems with OutOfMemoryException when loading a BLOB from Oracle.
We are still using Hibernate 3.6.10 . Our best approach to this testing right now is to simply generate more data than the system could handle in the normal use case and try to load the parent object and see if it works. Doing so just feels bad.
Any suggestions are welcome.
One note that I forgot to mention is that this idea of โโโregisteringโ is something that I would like to leave in working code to identify specific problems.
- EDIT -
Here is an example of what I'm trying to do:
Say I have an @Entity ClassX that has a lazy loaded list of @Entity ClassY objects. Some, like, I would like the log message to spit out when 100 or more ClassY instances are loaded into the session cache. Thus, during development, I can load the ClassX object and notice that if I (or another developer on the team) get access to this list when I shouldn't be.
source share