I am using JSF 2.1 and have a problem loading lists containing huge amounts of data. The data is fetched from a database via JPA, which basically looks like this: (just the relevant part, omitting getters and setters)
public class HostController {
private List<Host> allHosts;
@Inject
private HostService hostService;
public void beforeRenderLoadList(final ComponentSystemEvent event) {
allHosts = hostService.findAll();
}
}
This code is used in a metaevent preRenderView
on the xhtml-page.
It is working for smaller amounts of data, but since the original table contains about 6500 entries, it throws a stackoverflow error.
Is there any way to lazy load this list or to work around the error?
Thanks for your answers!
The problem has finally been solved by setting each entity's FetchType to LAZY!