You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Holdren, Dean" <dh...@about-inc.com> on 2003/05/22 17:33:42 UTC

Paged results and deletions in the database

Are there any good examples of dealing with large sets of data in a database
using some sort of paging technique (like 50 records a page, over 10 pages)
that allows deletion and editing of records while paging over this list?

The problem is that we may not be able to get all the records from the
database at once, so we might want to fetch portions of a ResultSet at a
time. But if we are concurrently deleting records from the db, I foresee a
problem.

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Paged results and deletions in the database

Posted by Vic Cekvenich <vc...@baseBeans.com>.
Working with resultset is not optimal, consider a DAO such as ibatis.com.

One good, scalable way is to pass the offset argument into retrieve, ex:

   [ LIMIT { count | ALL } ]
     [ OFFSET start 


limit ? offset ?
or limit 50 offset 3

(give me 3rd set of 50 rows).

in DB's that support it such as pgSQL. This is fast, scalable, cached, plus it does not stress the app. server even with many users.

hth,

Holdren, Dean wrote:

>Are there any good examples of dealing with large sets of data in a database
>using some sort of paging technique (like 50 records a page, over 10 pages)
>that allows deletion and editing of records while paging over this list?
>
>The problem is that we may not be able to get all the records from the
>database at once, so we might want to fetch portions of a ResultSet at a
>time. But if we are concurrently deleting records from the db, I foresee a
>problem.
>  
>

-- 
Vic Cekvenich,
Struts Instructor,
1-800-917-JAVA

Advanced <a href ="baseBeans.com">Struts Training</a> and project recovery in North East. 
Open Source <a href ="baseBeans.com">Content Management</a>  basicPortal sofware
Best practice<a href ="baseBeans.com">Struts Support</a> v.1.1 helper ScafflodingXPress