|
Hi everybody,
I have to retrive 300.000 rows with 120 columns (!!!!) through a sql join query.
This is a part of the code:
session.beginTransaction;
ScrollableResults join_result=q_JOIN.setCacheMode(CacheMode.IGNORE).scroll(ScrollMode.SCROLL_INSENSITIVE);
while(join_result.next()){
countrow++; int stat=session.getStatistics().getEntityCount(); if( stat > 20){ session.flush(); session.clear(); logger.info("row number = "+countrow+ ", entity num = "+stat); } // do something with the row ....
}
session.getTransaction().commit();
I'm sure the session is cleared , but after the elaboration of 41000 rows , the following excepiton is thrown:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
Before the exception throw, I noticed the elaboration slows down.
Someone know why it doesn' t function? Any suggestions?
Thanks in advance.
|