This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring in Action (5th edition) and have Craig Walls on-line!
See this thread for details.
Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

how to populate a large record set into JTable  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am accessing a database and trying to display them in JTable using count of 100.The resultset may well be very large (over 1,00,000 records).

The problem here is that I want to give user an illusion that He has got all the available data (for example,total number of record:5000), It means that scrollbar on the scrollpane should behave as if the JTable has got all the records(say 5000) but physically the table is holding just 100 records.

If user clicks the scrollbar down,using the index position I wish to display say 100 records to begin with, then as the user scrolls up and down the viewer further records are read from database and displayed.

Is there any solution for this.
 
Author
Posts: 965
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think JTable is already sort of
designed to do what you want. If
you write your table model's
getValueAt() method to query the
database for each cell, it will
query just the visible cells, not
all n*5000 of them. (Unless you're
sorting the rows or something like
that.)

Now of course you probably don't
want to have to query the database
each for every single call to
getValueAt(), but I bet you can
work out some kind of caching scheme.
 
amar rapuru
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Brian Cole,

Thanks for your reply.

I want to retrive the database records according to the Scroll bar position and display in JTabel.
 
I'm a lumberjack and I'm okay, I sleep all night and work all day. Lumberjack ad:
Download Free Java APIs to Work with Office Files and PDF
htttp://www.e-iceblue.com/free-apis.html
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!