• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Design help with Search method for GUI

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I hope someone can help, this must have been asked before but i could not seem to find a search on this problem.

I have implemented the standard search and book interface, which are the only methods available to the GUI. I am really confused.
my search method is a return type of String[][] which first retrieves the records using the find method and then reads the records one at a time into the String[].

Records are referenced by there position in the database flat file. Now my question is, once i use the search method to display values in the table. when it comes to making a booking how do i reference the record it belongs to

I dont want to search for the record, before using booking, by reading fields from the record.

I was thinking about making the search function have a return type of a hash map where the record Number is a key which points to String[] containing the data, but the question still arise how does a selected row in the table know its record number.

I hope this makes since
 
jesal dosa
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i was thinking rather than the search method returning String [][] what if i return an Hotel Record object which contains the fields as private data members with an additional field for the recNo, then i can use this generate and populated the table.

Any suggestions would be helpful
 
jesal dosa
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

After some more digging around i found the following two links which provide the answer. The answer seem to be quite simple. I can keep the String [][] and add the record no at the end of the array which i can then reference in the table model. This can then be selected and I can reference the record back to the database

Link 1

link2
 
reply
    Bookmark Topic Watch Topic
  • New Topic