First of all, thanks for the reply
My database table has about 50,000 records and I am getting those records in chunk exactly the way you menyioned.
If it is the single select, then it is not a memory leak, you are just trying to read too much data for your JVM.
Either increase your heap size, or read less data.
In JPA you can chunk a query result using JPA Query setFirstResult and setMaxResult.
In TopLink/EclipseLink you can also use a ScrollableCursor.
But as I get more and more data for example first 100 then next 100 ...I see on the task manager the memory consumption increasing gradually....
and after about 23,000 records are fetched the JVM blows up and OutOfMemory exception occurs.
Right now I am using same EntityManager for the whole select and I will try to get the select now witha new EntityManager per page.
Thanks and Regards,
Girish