-->
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.  [ 3 posts ] 
Author Message
 Post subject: OutOfMemoryError with large result set
PostPosted: Wed Sep 14, 2005 1:15 pm 
Newbie

Joined: Tue Sep 13, 2005 6:34 pm
Posts: 1
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.0

Mapping documents:
<hibernate-configuration>
<session-factory>
<!--SQL dialect-->
<property name="dialect">
org.hibernate.dialect.SQLServerDialect</property>
<!--JDDBC Connection pool-->
<property name="connection.pool_size">1</property>
<!-- comment things out as we move them to code-based configuration -->
<!--Echo all executed SQL to sdtout-->
<property name="show_sql">true</property>
<property name="jdbc.batch_size">20</property>
<!-- driver_class, url, username, password, and mapped resources will be
added in Java code -->
</session-factory>
</hibernate-configuration>

Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:

I have a query which returns around 380K rows. I understand with these things ScrollableResults is the way to go, so I did:

ScrollableResults sr = query.scroll(ScrollMode.FORWARD_ONLY);

This caused an OutOfMemoryError (no stack trace)

Is there a better way of doing this? Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 14, 2005 1:41 pm 
Beginner
Beginner

Joined: Tue Aug 16, 2005 11:06 pm
Posts: 46
did you release memory by calling session.clear() when you iterated through the results?

_________________
Jason Li
Don't forget to rate:)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 19, 2005 1:49 pm 
Expert
Expert

Joined: Sat Jan 17, 2004 2:57 pm
Posts: 329
Location: In the basement in my underwear
Definitely need to clear() the session as you iterate through. Also bear in mind if you are manipulating those objects in any way they will be kept around in the action list until the transaction is committed so you might still get memory creep.


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

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.