You really shouldn't attempt to display thousands of rows of data on a single web page. It's injurious to the eyes and sanity of the user. Plus, downloading all that data will give terrible performance, even if you scroll the display. It's far better to pre-filter the display to some reasonable size.
That's just general advice and not JSF-specific. One way to improve performance in
JSF is to realize that the UI Model object (the DataTable) doesn't actually have to be an ORM Persistence Model object. It can just as easily be made from selected items instead of the entire query result. Or, for that matter, you can refine your query to return only items of immediate interest.
PrimeFaces can handle scrolling of DataModels without hard-coded JavaScript.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.