File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Where to place RecNo? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Where to place RecNo?" Watch "Where to place RecNo?" New topic

Where to place RecNo?

Stef Widmer

Joined: Jun 16, 2004
Posts: 17
Hi all,
When I read records from the database, there might be deleted ones which should not be displayed in the GUI. So I have for example Record 1, 2,3, and 5 (because number 4 is marked as deleted) read from the database and sent to the client GUI. In the JTable on the GUI side, four records are displayed. If I book the fourth record (number 5 in the DB) I need to know the record number. So I guess I have to add the "real" record number to the array of Strings e.g. in the find methode. Is this a good approach or is there a better one?

I'm not shure becuase the Array of strings is not just containing the record fields and I don't know if this is OK with the interface DBMain.
Thanks for all hints...
Steven Hoodless
Ranch Hand

Joined: Mar 23, 2004
Posts: 64

I'd say you do need to pass a record number. Your process needs to know that when the user clicks on the 4th record on screen he/she is actually selecting record 23 in the database for booking.


Robert Konigsberg
Ranch Hand

Joined: Jun 23, 2004
Posts: 172
What I did was not pass string[] to the client, but rather:

class Record
String[] _data;
int _recordNumber;

That way the String[] has its meaningful representation, and so does both Record and _recordNumber.


SCJP 1.4 (91%)<br />SCJD 1.4 (376/400, 94%)
I agree. Here's the link:
subject: Where to place RecNo?
It's not a secret anymore!