File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes correct design of table GUI + large resultset Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "correct design of table GUI + large resultset" Watch "correct design of table GUI + large resultset" New topic
Author

correct design of table GUI + large resultset

Rudy Koento
Greenhorn

Joined: Aug 16, 2004
Posts: 7
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

Joined: Sep 25, 2003
Posts: 49
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
 
wood burning stoves
 
subject: correct design of table GUI + large resultset