• Post Reply Bookmark Topic Watch Topic
  • New Topic

database/session Problem

 
Hrithik Roshan
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm confused now!
i have developed a web application based on MVC pattern.
i have 8000 records to show;
and per page i have to show only 10 records;
wht am i suppose to do..
hit the database for every next 10 records
or get the result set into vector and put the vector int session;
i m currently putting the whole thing into session and iterating thought the session;
works fine;
but i m not satisfied!!!
please someone help me!!!
 
Venkatraman Balasubramanian
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Consider the following:
1. Retrieve the specific range of result set using a Stored procedure. Logic here would be tricky depending on the Database in use.
2. Cache the contents of the resultset (Disconnected) in a Statefull Session Bean. The EJB container must provide support for clustering and fail-over support for Statefull Session Beans. If not, you might end-up retrieving the data from the database again, during fail-over scenarios.
3. Have a Singleton object that can hold the content for you. Logic here would be tricky on a clustered environment.
If you have no problems with dirty read and don't need a snapshot, (1) would provide better for performance.
Hope this helps.
 
Hrithik Roshan
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm sorry to say i m not using any EJB!
any help!!!
Originally posted by Venkatraman Balasubramanian:
Hi,
Consider the following:
1. Retrieve the specific range of result set using a Stored procedure. Logic here would be tricky depending on the Database in use.
2. Cache the contents of the resultset (Disconnected) in a Statefull Session Bean. The EJB container must provide support for clustering and fail-over support for Statefull Session Beans. If not, you might end-up retrieving the data from the database again, during fail-over scenarios.
3. Have a Singleton object that can hold the content for you. Logic here would be tricky on a clustered environment.
If you have no problems with dirty read and don't need a snapshot, (1) would provide better for performance.
Hope this helps.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There have been multiple very good discussions on the subject in this forum and the JDBC forum. Rather than try to repeat the arguments (and get them wrong), I recommend searchng for things like "pag ResultSet" (ie to match both page and paging)
DOM
 
babu
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
u can overcome this problem with some tricky codes.
u can use rownum (oracle 8i) like this to retrive
10 records at a time
select * from emp where rownum<10
problem here is u have to use one unique filed to retrive other datas
eg:
select * from emp where rownum<10
select * from emp where empno>10 and rownum<10
here empno should be unique.
 
Hussain
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think Hrithk is busy in Movies he has no intrest in JAVA ....................... :roll:
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
babucb,
Please read the Javaranch name policy and change your display name to conform with the policy. Thanks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!