Java WEB Paging

Asked

Viewed 191 times

-2

I have an application developed in Java Web and need to know what is the best way to paginate grid and whether, depending on how it was developed, I may have performance problems as a "Date" parameter and whether this can influence when exporting a report on. CSV.

I do the paging in the application itself or using the database?

1 answer

1

Your question is quite generic/broad so it is not possible to give a very concrete answer.

Thus, follow some observations/answers and all assume that it has no defined technology:

I do the paging in the application itself or using the database?

I would make the pagination in the database.

The view sends the information of which page is and how many lines should be searched and the bank performs this operation. I would hardly carry everything in the view and only page in the view. I would do this only in cases where the volume of data was extremely low and that it would not increase with time.

I may have performance problems as a parameter of "Date"?

No. Unless you do multiple format conversions, sorting and etc.

This can influence when exporting a report in . csv?

Making the pagination in the bank, at the time export, then yes you must make a query to return everything from the bank, because if exporting what is being displayed, well, will only export what is being displayed hehe. While performing the "whole query" in the database, obviously it will take a little longer to recover the data, but it will work.

If the volume of data is too large, some should be done flushs during export. Flush is the action of transferring the data from memory to the file itself, because if you keep everything in memory and the data volume is high, one hour you will probably get one OutOfMemoryError or something like.


As a reference only, here is the documentation of the method flush() class OutputStream which explains in detail what is done.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.