This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Originally posted by Ameya Thakur: I wanted my Resultset to get only the last 'n' records from the resultSet.
Say for Example, My Query Return 10 rows and i wanted to display only the last 4 records of the query.
This can be done in java as well as on DB side. Which way you want to do it depends on your total number of records and some other factors.
1. In java approach, fetch all records from DB. Then using ScrollableResultSet, display only certain number of records each time.
2. In DB approach, write a query such that you will only fetch those records which are to be displyed. Here, for showing next set of records, you have to query the DB again. I have not used this approach much, but these queries are usually written using default "ROWNUM" field (I am talking about Oracle).
I Hope this will help.
Joined: Feb 04, 2004
Thanks for your help, But this solution wont solve my problem.
As i am using Scrollable ResultSet the ResultSet is Fetching me 10 rows and i have a field in the Table called as Concurrency which tells me how many time the record has been updated.
So Depending upon the Concurrency Count i want to get those Many Records