• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to make pagination?

 
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
This is a very common problem for any web application.
I need to make search which may result in thousands of records.
So, accordingly the page will be displayed (say, 10 results per page).

1st Approach:-
I make the query to hit database everytime a search is requested.So, for every page a search is unnecessarily performed.

2nd Approach:--
I store the result in the meory. So, say 1000 record have been searched and stored in the memory. So, not for every page result a new search is
required. But..., here I can't predict the search size, so I may get OutOFMemoryException.

3rd Approach :-
Since my DB is Oracle. I want to make a temp table to store the result od the search. But in Oracle , I think there is only Global Temp table, So, How it can handle the search , if there are multiple persons making the search at the same time.

:roll:
 
Ranch Hand
Posts: 1491
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try thru CachedRowSet
 
Mishra Anshu
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can it avoid the OutOfMemory exception???
 
author & internet detective
Posts: 41878
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mishra,
For Oracle, look into materialized views. It's a caching technology on the db server.

If you are writing your own (options 1/2), consider whether you need all the results. A lot of users abandon the search without paging at all. In that case you only need the first 20 or so records. Getting more is a waste of resources.
 
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mishra,
Since you are using Oracle, go to the Ask Tom Web site, and do a search for "pagination".

Good Luck,
Avi.
 
reply
    Bookmark Topic Watch Topic
  • New Topic