Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Paging large record set with EclipseLink Query using Sybase runs out of memory

I'm not sure if Sybase supports pagination similar to Oracle.  If it does
please log a bug and include the SQL syntax required on Sybase.  You could
extend the Sybase platform with such syntax if it exists (please contribute
the patch if you do).  Or you could use the native SQL query in your code.

It is odd that you run out of memory with firstResult, it will basically
skip over the firstResult rows, so there should be nothing holding them in
memory, it could be a JDBC driver issue.  Make sure you create a new
EntityManager for each page query, and ensure you are using a weak cache. 
You may also try increasing your JVM memory.

You may also be able to page by some field in your object.  i.e. where > 'A' and < 'C' (and page through A-Z).

gsilverman wrote:
> Has anyone found a way to page a large record set in EclipseLink without
> running out of memory using Sybase?
> I have a zip code entity, Zip, which basically maps to a zip table storing
> zip codes, city, state and country information with 100,000s of rows.
> When I query using:  
>                 String query = "select z from Zip z";
>                 Query q = entityManager.createQuery(query);
> 		q.setFirstResult(firstResult)
> 		.setMaxResults(100)
> 		.getResultList();
> Everything is fine up to firstResult = 15000, but I get
> "java.lang.OutOfMemoryError: Java heap space"
> errors for firstResult greater than that.
> I'm using Sybase as the underlying database, and I see in 
>  a workaround for
> Oracle. Does anyone have a fix for Sybase?

--- James Sutherland
 EclipseLink ,
Wiki: EclipseLink , TopLink 
Forums: TopLink , EclipseLink 
Book: Java Persistence 
View this message in context:
Sent from the EclipseLink - Users mailing list archive at

Back to the top