Hi, I am still staying with the same problem with displaying the initial data into my Table after the application have been started. I have some ideas but i am not sure what idea is correct or more reasonable.
1. Search for all records by calling the SUN-provided method find(String[] criteria) with empty criteria. It's my favorite
2. Call the SUN-provided method read(int recNo) up to that time i recieve a RecordNotFoundException. But i think this is not a good idea, because RecordNotFoundException will be thrown when the record has a deleted flag. And this stops after the first deleted record will be found.
3. To provide one of two additional method in the DataAdaptor: getRecordCount() or getAllRecords() But i am not sure if it is right.
How do you think what is the best way to do this? Or do you have another ideas? I am very appreciated for you comments.
Thanks Olena
SCJP 1.4<br />SCJD 1.4 (in progress)
Anonymous
Ranch Hand
Joined: Nov 22, 2008
Posts: 18944
posted
0
I've implemented No 1, pretty much because you need to implement a find method which returns all results anyway. So doesn't really require any extra work.
I wouldn't have implemented option 2 due to the reasons you give.
Option 3 is do-able, I believe, as its been mentioned else where that you CAN extend the interface provided by Sun. Whether it provides an easier or cleaner implementation than option 1 is open to debate. I think some folks have implemented this option though.
Cheers, Matt.
Arun Subramanian
Ranch Hand
Joined: Oct 30, 2002
Posts: 47
posted
0
3. To provide one of two additional method in the DataAdaptor: getRecordCount() or getAllRecords() But i am not sure if it is right.
I am using a "getRecordCount()" approach which is defined in my implementation of the SUN provided Data Interface. This gives my TableModel the number of rows for initial display. I also have a "getSchemaDescription()" method (again defined in the same above implementation) for storing the database file schema information and which gives my TableModel the number of columns for initial display.