aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes [NX:URLyBird] About deleted record Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "[NX:URLyBird] About deleted record" Watch "[NX:URLyBird] About deleted record" New topic
Author

[NX:URLyBird] About deleted record

Leo Tien
Ranch Hand

Joined: Sep 10, 2002
Posts: 156
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.
Philippe Maquet
Bartender

Joined: Jun 02, 2003
Posts: 1872
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

Joined: Sep 10, 2002
Posts: 156
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?
Vlad Rabkin
Ranch Hand

Joined: Jul 07, 2003
Posts: 555
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

Joined: Sep 10, 2002
Posts: 156
Thanks, Vlad.
These are just I want to know.
Thanks again.
 
Don't get me started about those stupid light bulbs.
 
subject: [NX:URLyBird] About deleted record