db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Vandahl ...@apache.org>
Subject Re: LargeSelect example ?
Date Sat, 13 Oct 2007 14:50:09 GMT
Yannick Richard wrote:
> Hi,
> I am currently working on a Torque project that will handle database
> synchronization. 
> The problem we have is an Out of Memory exception while selecting a big
> bunch of data from the database.
> Here is the command we are using :
> List ObjectsFromDB = ObjectPeer.doSelect(criteria, connection);
> I saw the LargeSelect class you worked on but cannot find any Java
> example that could help me go forward.
> Could you help me point to an example or help me understand how to
> integrate LargeSelect ?

Just a few hints, I don't have a complete example at hand:

	LargeSelect ls = new LargeSelect(criteria, pageSize,

where the pageSize defines how many records to get with one call and the
memoryPageLimit defines how many of these pages to "read ahead".

With this object you can now loop through the pages and LargeSelect will
load the necessary data as needed, (pageSize * memoryPageLimit) records
at a time. Like:

	while (ls.getNextResultsAvailable())
		List ObjectsFromDB = ls.getNextResults();
		// do what is necessary

See the JavaDoc at
for more information.

Bye, Thomas.

To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org

View raw message