0

I'm trying to render a list of records in a jsf page with a query that returns many records, I'm using weblogic 10.3.0.0 and sql server driver 4 from Microsoft to connect a sql server database, when I run this jsf page, this consumes a lot of memory because the query returns many record and therefore a OutOfMemoryError is occurring. I've seen that with setFetchSize you can limit the results, but here:

What does Statement.setFetchSize(nSize) method really do in SQL Server JDBC driver?

the microsoft's sql server driver not limit this, I used jDTS driver as the above post has suggested, but the same problem ocurre, I've also tried to use this:

http://msdn.microsoft.com/en-us/library/bb879937.aspx

for use adaptive buffering with the driver, but my driver version is 4 so this by default has adaptive buffering, but apparently no, I've tried this:

 statement = connectionDB.createStatement();
 SQLServerStatement SQLstmt = (SQLServerStatement) statement;
 SQLstmt.setResponseBuffering("adaptive");

but this no returns results, I've put this in the connection properties also, but the problem still occure, I understand that the problem is the query have big results and the driver no execute it with chunks, and therefore the memory is decreasing, and I believe that this is the problem. I don't know who workaround use, if do the manual pagination with the query, if use another driver, etc., please help me to find a workaround, whatever info is well received, sorry for my poor english

Community
  • 1
  • 1
  • http://stackoverflow.com/questions/7382486/efficient-jsf-pagination – Alan Hay Dec 18 '14 at 21:49
  • Thanks @AlanHay for you reply, but I undestand that the pagination is when the info is already charged in memory, I need load the query first. BTW, I'm not using EJB and JPA, I'm using JDBC. – Efrain Toribio Reyes Dec 18 '14 at 21:56
  • 1
    No, regardless of the framework, a 'proper' solution will page at the database level. The accepted answer appears to give two solutions which will handle paging at the database level i.e. only hold in memory the records actually displayed. – Alan Hay Dec 18 '14 at 22:04
  • Thanks Alan; that is; my solution was make a primefaces's Lazy Data Model, I've used the primefaces 3.5 showcase ; many thanks for you reply. – Efrain Toribio Reyes Dec 20 '14 at 22:08

0 Answers0