• 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

[NX:URLyBird] About deleted record

 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1.

Any methods that throw RecordNotFoundException should do so if a specified record does not exist or is marked as deleted in the database file.

Which condition should throws this Exception? Since the record has been deleted, why should query it, since shouldn't query it, why throw RecordNotFoundException?
In my DBMain interface have several methods throw this Exception, such as lock and unlock, since the record has been deleted, why lock it?
2. When the client click the "search all" button to search all the records in the db.db file, whether the deleted record is displayed too?
3.

1 byte "deleted" flag. 0 implies valid record, 1 implies deleted record

Because the functions in this application only are search and update, don't include delete or create, what use this "deleted" flag is?
Now, I can think about the deleted record only above, can anybody add more? Post it on this thread, let's summarize it.
 
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Leo,

Which condition should throws this Exception? Since the record has been deleted, why should query it, since shouldn't query it, why throw RecordNotFoundException?
In my DBMain interface have several methods throw this Exception, such as lock and unlock, since the record has been deleted, why lock it?


RecordNotFoundException is there to tell you that a record is deleted. How else would you know it ?

2. When the client click the "search all" button to search all the records in the db.db file, whether the deleted record is displayed too?


No, from the client point of view, deleted records simply don't exist.

Because the functions in this application only are search and update, don't include delete or create, what use this "deleted" flag is?


Your client application only needs search and update, but you must implement create and delete functionalities in your database system. Other applications may need it, or even yours for future enhancements.
Best,
Phil.
 
Leo Tien
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Philippe:

RecordNotFoundException is there to tell you that a record is deleted. How else would you know it ?


The assignment said that

Any methods that throw RecordNotFoundException should do so if a specified record does not exist or is marked as deleted in the database file.


Which condition is that I query the record that does not exist? Whether is the client search the record by name and/or location, but no result return, at this time, throws RecordNotFoundException and notify the user the result is null?
 
Ranch Hand
Posts: 555
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Leo,

Which condition is that I query the record that does not exist


I am not sure I understand your question, but I hope my answer is what you want to know:
1.) you search for records. You found some.
2.) you try to book a record from those you just have found, but somebody
have just deleted a record. Your should get RecordNotFoundException.
Another scenario if you strictly use the interface provided by Sun:
1) you found some record and your find method returned array of int.
2) you loop through the array to read the found records
3) Some records can be in meantime deleted. So, you will get RecordNotFoundException.
Best,
Vlad
 
Leo Tien
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, Vlad.
These are just I want to know.
Thanks again.
 
Montana has cold dark nights. Perfect for the heat from incandescent light. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic