• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

How to implement createShared() method of CachedRowSet?

 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I need to create a copy of the existing cachedrowset object for pagination.
I have a link which on click will display a page with 16 records and at the bottom there will next,prev button for pagination.
So on 1st click of the link I am:
1. passing the pageNo as 0
2. fetching all the records from the db as Resultset Object.
3. passing pageNo as 1 and populating 16 records from the resultset.

Now when i will click the next button i am passing the pageNo as 1,but i am going to the same method where i have populated the CRS object with RS object.
I have the intention of fetching next set of records which is there in CRS object,but again the RS query is executed,which i dont want.
I want all my records shud be populated in the CRS object from the RS object only once.
Each time i am clicking the next or prev button i wll iterate the CachedRowSet and display in jsp.
I tried CreateShared() ..buts its not working.

Please Suggest....



Thanks
Amarshi
 
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Did you populate the CachedRowSet following this principle:


That should populate your cache. When you navigate the cache, there is no need to go to the database.

disclaimer found on the same page:

However, a CachedRowSet object does have a limitation: It is limited in size by the amount of data it can store in memory at one time.




i am going to the same method where i have populated the CRS object with RS object.
I have the intention of fetching next set of records which is there in CRS object,but again the RS query is executed,which i dont want.

Put a check in your code, so that it does not have to redo the query and CachedRowSet population if it has already been done.


When you try to build a pagination mechanism, it is good to look at what the ranch has to offer you, in it's FAQs and Journal.
 
amarshi mohanty
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jan Cumps wrote:Hi,

Did you populate the CachedRowSet following this principle:


That should populate your cache. When you navigate the cache, there is no need to go to the database.

disclaimer found on the same page:

However, a CachedRowSet object does have a limitation: It is limited in size by the amount of data it can store in memory at one time.




i am going to the same method where i have populated the CRS object with RS object.
I have the intention of fetching next set of records which is there in CRS object,but again the RS query is executed,which i dont want.

Put a check in your code, so that it does not have to redo the query and CachedRowSet population if it has already been done.


When you try to build a pagination mechanism, it is good to look at what the ranch has to offer you, in it's FAQs and Journal.






Hi jan,
I am using like below:

crs.populate(rs,crs1.getPageSize()* pageNum);

This works for the page-0 when i go for next page ,this wil work but again the query has to be executed.
even if i wll make use of creteCopy() method of CRS then it wll add only those records which are present in the original CSR object.


Thanks
Amarshi
 
I RELEASE YOU! (for now .... ) Feel free to peruse this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic