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:
- maximize memory heap
- use
scrollableresults
avoid memory issues
i prefer solution number 2 because definitive; first 1 can still cause memory problem.
Comments
Post a Comment