Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You will always have memory problems when the Java code hauls/copies the <strong>entire</strong> dataset of a datastore (e.g. a RDBMS) in Java's memory and then do the sorting and filtering right in Java's memory using Java code. It will get worse when you even store it in the session scope of a webapplication.</p> <p>The most memory efficient approach is to let the DB do the task where it is invented for. The SQL language offers you under each the <code>ORDER BY</code> clause to do the sorting, the <code>WHERE</code> clause to do the filtering and the (DB vendor specific) <code>LIMIT/OFFSET</code> clauses/subselects/functions to return only a subset of records based on <em>firstrow</em> and <em>rowcount</em> or <em>lastrow</em>. This way you end up with <em>only</em> the dataset in Java's memory which is actually to be displayed.</p> <p>There is no standard JSF component which does exactly that. It will always require the entire dataset being available in the Java memory, because the filtering and sorting needs to happen with pure Java code or Javascripts. JSF knows nothing about SQL, you'll need to provide a custom implementation of <a href="http://java.sun.com/javaee/6/docs/api/javax/faces/model/DataModel.html" rel="nofollow noreferrer"><code>javax.faces.model.DataModel</code></a> to the datatable and/or control/manage that in the data access layer yourself. You can get a lot of new insights/ideas and find a kickoff example in <a href="http://balusc.blogspot.com/2008/10/effective-datatable-paging-and-sorting.html" rel="nofollow noreferrer">this article</a>. You can also find examples of the needed SQL queries in <a href="https://stackoverflow.com/questions/1986998/resultset-to-pagination">this JSP-targeted answer</a> I posted before here.</p> <p>Good luck.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload