These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Java Heap Space problem
PostPosted: Wed Oct 22, 2008 9:00 am 
Newbie

Joined: Wed Oct 22, 2008 5:58 am
Posts: 1
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.