posted 15 years ago
Hi,
I have a web application using Hibernate 3.x and allow users to download 28k++ database rows as a CSV file for reporting purposes. What I did was read all the rows as objects, extracted each attributes and write each value out to the output stream as CSV. Using this method, my JVM memory footprint increased by 40MB or more. What I want is to able to reduce the footprint increment to 10MB or less because the process is pretty straight forward. The rows has no relationship with each other i.e. the next row need not refer to the previous row which can be discarded after writing to the output stream. How do I make Hibernate do that?
I have tried using iterator as in
getSession().createQuery("from Customer c").iterate();
Or anyone can suggest a better way to do this? Please advise.
Thank you.