How to calculate the size of Criteria query result set for hibernate? -


how calculate size in bytes (not number rows) of resultset returned criteria query? receive out of memory exception , on analysis of heapdump found org.hibernate.impl.sessionimpl object bloated object. have 1 complex query executed multiple times , returns >4000 rows 150 columns in each row. want find out if offending query trying size of resultset?

meanwhile trying session.clear (will work) after results set fetched. there other steps can follow reduce sessionimpl size in memory? thanks

you can follow calculate size of object in java answer.
if have memory problem better solutions can be:

  1. maximize memory heap
  2. use scrollableresults avoid memory issues

i prefer solution number 2 because definitive; first 1 can still cause memory problem.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -