• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

correct design of table GUI + large resultset

 
Rudy Koento
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hullo,

I don't know where should I post this question, so I'll post it here first.

I'm coming from VB and would like to move to Java programming, and needed some help in how to design my program correctly.

Let's say I want to write a GUI with a table, filled with data from a large database (1,000,000 records). What should I do? There are a few questions that are in my mind:

1) getting data into the table from the resultset is going to take a very long time. Is there an easy way to fetch only 50 or something, and when the user page up or page down, it will fetch the previous or next 50? I'm hoping that there's a way to do it in java without having to code the paging part.

2) an update or insert of record would need to refresh the table. Will it refetch the data from the database?

3) column sorter is best done in the database or in java? Because if from database, that would mean refetching the data...

4) is it a good idea to put the data into arraylist or something? Because from java gui books I read, they put the data into the arraylist. But if the data is large, I doubt it's a good idea...

5) Is there any book that describe the above? Those common pitfalls that we can avoid, such as what to do if the resultset is large, etc?

Java seems to be very powerful, but learning it makes me want to

 
Sainath Veepuri
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rudy,

1) getting data into the table from the resultset is going to take a very long time. Is there an easy way to fetch only 50 or something, and when the user page up or page down, it will fetch the previous or next 50? I'm hoping that there's a way to do it in java without having to code the paging part.
===> Make sure that your resulset object is scrollable. I don't think there is a specific method in the resultset api to get the first 50 rows. Alternative, suggestion would be to use a counter variable inside your loop.

2) an update or insert of record would need to refresh the table. Will it refetch the data from the database?
===> I couldn't get this question.

3) column sorter is best done in the database or in java? Because if from database, that would mean refetching the data...
===> Provide sorting from the java (table) itself.

4) is it a good idea to put the data into arraylist or something? Because from java gui books I read, they put the data into the arraylist. But if the data is large, I doubt it's a good idea...
===> Depends on the requirement. Try to initialize the array before you use it.

5) Is there any book that describe the above? Those common pitfalls that we can avoid, such as what to do if the resultset is large, etc?
===> search the web

Hope this helps,
SAI
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic